Collection Interfaces in C#
In C#, all collection
types use some common interfaces. These common interfaces define the basic
functionality for each collection class.
IEnumerable interface acts as a base interface for all the
collection classes. IEnumerable is further extended by ICollection. ICollection
is also further extended by IDictionary.
IEnumerable Interface: IEnumerable
interface provides an enumerator which supports a simple iteration over a
ICollection Interface: ICollection
interface defines size, enumerators and synchronization methods for all
IDictionary Interfaces: IDictionary interface
represents a non-generic collection of key/value pair.
IList Interface: IList interface
represents a non-generic collection of objects that can be individually
accessed by index.
All collection interfaces are not implemented by all the
collection classes. It’s depends on the collection
nature. For example, IDictionary interface will be implemented by only those
collection classes which supports key/value pairs like Hashtable and SortedList