ICollection Interface

July 28, 2014

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

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

public interface ICollection : IEnumerable

The ICollection type exposes the following members.

  NameDescription
Public propertyCountGets the number of elements contained in the ICollection.
Public propertyIsSynchronizedGets a value indicating whether access to the ICollection is synchronized (thread safe).
Public propertySyncRootGets an object that can be used to synchronize access to the ICollection.
Top

  NameDescription
Public methodCopyToCopies the elements of the ICollection to an Array, starting at a particular Array index.
Public methodGetEnumeratorReturns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Top

  NameDescription
Public Extension MethodAsQueryableConverts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension MethodCast<TResult>Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension MethodOfType<TResult>Filters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Top

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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft