ICollection Interface

ICollection Interface


Defines size, enumerators, and synchronization methods for all nongeneric collections.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

public interface ICollection : IEnumerable


Gets the number of elements contained in the ICollection.


Gets a value indicating whether access to the ICollection is synchronized (thread safe).


Gets an object that can be used to synchronize access to the ICollection.

System_CAPS_pubmethodCopyTo(Array, Int32)

Copies the elements of the ICollection to an Array, starting at a particular Array index.


Returns an enumerator that iterates through a collection.(Inherited from IEnumerable.)


Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)


Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)


Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)


Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The ICollection interface is the base interface for classes in the System.Collections namespace.

The ICollection interface extends IEnumerable; IDictionary and IList are more specialized interfaces that extend ICollection. An IDictionary implementation is a collection of key/value pairs, like the Hashtable class. An IList implementation is a collection of values and its members can be accessed by index, like the ArrayList class.

Some collections that limit access to their elements, such as the Queue class and the Stack class, directly implement the ICollection interface.

If neither the IDictionary interface nor the IList interface meet the requirements of the required collection, derive the new collection class from the ICollection interface instead for more flexibility.

For the generic version of this interface, see System.Collections.Generic.ICollection<T>.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft