ICollection Interface
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Defines size, enumerators, and synchronization methods for all nongeneric collections.
Assembly: mscorlib (in mscorlib.dll)
The ICollection type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Count | Gets the number of elements contained in the ICollection. |
![]() | IsSynchronized | Gets a value indicating whether access to the ICollection is synchronized (thread safe). |
![]() | SyncRoot | Gets an object that can be used to synchronize access to the ICollection. |
| Name | Description | |
|---|---|---|
![]() | CopyTo | Copies the elements of the ICollection to an Array, starting at a particular Array index. |
![]() | GetEnumerator | Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.) |
| Name | Description | |
|---|---|---|
![]() | AsQueryable | Converts an IEnumerable to an IQueryable. (Defined by Queryable.) |
![]() | Cast<TResult> | Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.) |
![]() | OfType<TResult> | 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. An IList implementation is a collection of values and its members can be accessed by index.
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>.


