Collection Interfaces

The collection classes have many methods in common, which make them more predictable and easier to program because of their consistency. This consistency is maintained by the use of specialized collection interfaces. Table 26.1 details the interfaces implemented by collection classes.

Table 26.1. Collection Interfaces
Interface NameDescription
ICollectionEnumerator, size, and synchronization for all collections
IComparerCompares two objects
IDictionaryKey/value pair collection
IDictionaryEnumeratorEnumerator for IDictionary
IEnumerableGets an enumerator
IHashCodeProviderObtains a hash code
IListIndexed collection

Collections implement one or more of these collection interfaces. The interface they implement will depend upon the type ...

Get C# 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.