Prev: How do I use foreach to write each item when inheriting fromNameObjectCollectionBase
Next: Accessing a Profile Value from a Class
From: Peter Duniho on 13 Feb 2010 03:36 Tony Johansson wrote: > Hi! > > The purpose of CollectionBase is to create a custom collectionclass that > derivs from CollectionBase > In the CollectionBase class there are two members called List and InnerList. > List return an IList and InnerList is an ArrayList. > I just wonder what is the point to use List because InnerList contain all > that exist in List + some more. Seems to me that the docs are pretty clear at least with respect to one major reason to use the List property instead of InnerList: The On* methods are invoked only on the instance returned by the List property, but not on the instance returned by the InnerList property. In other words, if you want your own derived collection class to be able to detect changes to the underlying list data structure, you need to use the IList implementation retrieved from the List property, not the ArrayList you get back from InnerList. Pete |