Home > DeveloperSection > Blogs > Collection Interfaces in C#

Collection Interfaces in C#


C# C#  Collection 
Ratings:
0 Comment(s)
 678  View(s)
Rate this:

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


Don't want to miss updates? Please click the below button!

Follow MindStick