Custom Collections
Like Java, .NET makes it difficult to subclass concrete collection classes to provide specialized behavior without implementing large amounts of functionality. There always seems to be some vital method or inner class that is not accessible. Both languages provide abstract classes as the mechanism for custom designs, but we think that the .NET classes are better thought out.
The abstract classes in .NET are listed in Table 9-7.
Table 9-7. Abstract .NET Collection Classes
Class | Description |
---|---|
CollectionBase | Provides a basis for strongly typed collections. |
ReadOnlyCollectionBase | Provides a basis for strongly typed collections that don’t permit elements to be modified. |
DictionaryBase | Provides a basis for strongly typed collections of key/value ... |
Get C# for Java Developers 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.