blog

Home / DeveloperSection / Blogs / Collection Interfaces in C#

Collection Interfaces in C#

Anupam Mishra4382 01-Jan-2016

In C#, all collection types use some common interfaces. These common interfaces define the basic functionality for each collection class.


Collection Interfaces in C#

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 non-generic collections.

 

ICollection Interface:  ICollection interface defines size, enumerators and

synchronization methods for all non-generic collections.

 

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 etc.


Updated 13-Mar-2018

Leave Comment

Comments

Liked By