views:

165

answers:

0

Hi everyone,

Please help me with this.

I have a custom collection class which implement ICollection, IDictionary, ... so it act as traditional List but i can raise custom event.

The custom collection class has following property: - An inner list that hold values - A DataSource and DataField

Then I create a Custom Control which has a Values property is an instance of above collection class. My work is to build a custom CodeDOMserializer to serialize the Custom Control into designer file which the logic as following:

if (DataSource != null) {
     //serialize data source and datafield only, ignore inner list
  } else {
     //serialize the inner list
  }

My approach is like this:

call serializer of CustomControl --> call serializer of custom collection

My problem is: the serializer doesnt serialize properties of custom collection, it always assign a value from resources to that collection like below:

userControl1.Values = (DoubleCollection) Resoures.GetObject(....);

--> How could I do to get serialer to serialize DataSource and inner List instead of get object from resource? And How could i serialize DataSource if it point to a database?

Thank you