How can I persist a collection of items into code
The CollectionEditor allows adding and removing items from a collection at design time. If the items in this collection implement IComponent or if they are derived from Component, the items in your collection can be persisted in code.
Download collectioneditorsample.zip for a complete sample project.
Here are some steps you should follow:
1) Make sure your item is derived from Component or implements Icomponent.
2) Next implement your Collection. You have to implement the Ilist interface. The CollectionEditor will determine the type of instances to be added to your collection using reflection inspecting the return type of the Item property (Indexer).
3) Reference this collection in your control or component that should be designable. You need to supply a DesignerSerializationVisibility and an Editor attribute: