Hello,

I have a control which have member of type 'List<MyCustomItem>'.

I wanted to generate this property by myself using 'CodeDomSerializer".

Todo so i created a class 'MyCustomList' which inherit from 'List<MyCustomItem>'.
I added attribute 'DesignerSerializer' which points to a class that inherit 'CodeDomSerializer".

i override the Serialize method and returned 'CodeStatementCollection' object.

The code serialized great in method 'InitializeComponent' and looks something like:

this.MyControl.MyCustomCollection = new Sakal.MyCustomList();
this.MyControl.MyCustomCollection.Add(New Sakal.MyCustomItem());
this.MyControl.MyCustomCollection[0].DataType = "car";
this.MyControl.MyCustomCollection[0].DataName = "Toyota";

At runtime it works great since the method 'InitializeComponent' is called and fill my array.

The problem occurs when openning the form which holds the component at design-time.

The component is filled with empty values, as if the calls which assign the values to the properties are not exists.

I tried to override the method 'Deserialize' but it seems not to be executed (i used breakpoints to ensure it).

My questions are:

1. what do i do wrong? why doesn't the list items filled?
2. if i should override deserialize : why doesn't it being executed? how to implement it?


Comments:
1. I know that in most of the situations it is adviced not to use CodeDomSerializer but it seems that i must to so.
2. I know that i can serialize the in text/resource file but be aware that the example above is only an example, i already checked all my options before choosing that one.


Hope for quick responses,

Many thanks,
Eran.