>>>private HeaderCollection _Headers = new HeaderCollection(); >>>public HeaderCollection Headers >>>{ >>> get { return _Headers; } >>> set { _Headers = value; } >>>} >>>>>>
>>>public class HeaderCollection : CollectionBase >>>{ >>> public ColumnHeader this[int index] >>> { >>> get { return (ColumnHeader)InnerList[index]; } >>> set { InnerList[index] = value; } >>> } >>> public HeaderCollection() >>> { >>> } >>> >>> public int Add(ColumnHeader Header) >>> { >>> return InnerList.Add(Header); >>> } >>> >>> public int IndexOf(ColumnHeader Header) >>> { >>> return InnerList.IndexOf(Header); >>> } >>> >>> public void Insert(int index, ColumnHeader Header) >>> { >>> InnerList.Insert(index, Header); >>> } >>> >>> public void Remove(ColumnHeader Header) >>> { >>> InnerList.Remove(Header); >>> } >>> >>> public bool Contains(ColumnHeader Header) >>> { >>> return InnerList.Contains(Header); >>> } >>>} >>>>>>
>>>MyControl.ColumnHeader oHeader1 = new MyControl.ColumnHeader();
>>>MyControl.Headers.Add(oHeader1);
>>>
>>>public class HeaderCollection : Collection<ColumnHeader>>
public class HeaderCollection: : List<ColumnHeader>. My understanding is that the List generic has better performance than the Collection, but isn't as tidy under the hood.