Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>from codeproject article [<a href="http://www.codeproject.com/KB/cs/dzcollectioneditor.aspx][1]" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/dzcollectioneditor.aspx][1]</a></p> <blockquote> <p>There are three requirements that a collection should meet in order to be successfully persisted with the CollectionEditor:</p> <ol> <li>First, the collection must implement the IList interface (inheriting from System.Collections.CollectionBase is in most of the cases the best option).</li> <li><p>Second, it must have an Indexer (Item in VB.NET) property. The type of this property is used by the CollectionEditor to determine the default type of the instances that will add to the collection.</p> <p>To better understand how this works, take a look at GetItemType() function of the CustomCollectionEditorForm:</p> <p>protected virtual Type GetItemType(IList coll) { PropertyInfo pi= coll.GetType().GetProperty("Item", new Type[]{typeof(int)}); return pi.PropertyType }</p></li> <li><p>Third, the collection class must implement one or both of the following methods: Add and AddRange. Although IList interface has an Add member and CollectionBase implements IList, you still have to implement an Add method for your collection, given that CollectionBase declares an explicit member implementation of the IList’s Add member. The designer serializes the collection according to what method you have implemented. If you have implemented both, the AddRange is preferred.</p></li> </ol> </blockquote> <p>In this article you'll find everything you need to implement your collection on the property grid</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload