Creating Custom Collections

Creating custom collections is a relatively simple, if not tedious, task. To create a Collection, simply create a class that implements the ICollection interface. However, to implement the ICollection interface, you must also implement the IEnumerable interface. If the custom collection that you plan to implement does not use a list of some sort that already implements this interface, you will have to implement it yourself.

Implementing the CollectionBase Class

To make the task of creating a custom collection easier, the .NET Framework provides a base class called CollectionBase. The CollectionBase class is an abstract base class for providing strongly typed collections. Instead of writing your own base class, it is ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.