4 out of 7 rated this helpful - Rate this topic

ICollection Interface

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

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)
[ComVisibleAttribute(true)]
public interface ICollection : IEnumerable

The ICollection type exposes the following members.

  Name Description
Public property Supported by the XNA Framework Supported by Portable Class Library Count Gets the number of elements contained in the ICollection.
Public property Supported by the XNA Framework Supported by Portable Class Library IsSynchronized Gets a value indicating whether access to the ICollection is synchronized (thread safe).
Public property Supported by the XNA Framework Supported by Portable Class Library SyncRoot Gets an object that can be used to synchronize access to the ICollection.
Top
  Name Description
Public method Supported by the XNA Framework Supported by Portable Class Library CopyTo Copies the elements of the ICollection to an Array, starting at a particular Array index.
Public method Supported by the XNA Framework Supported by Portable Class Library GetEnumerator Returns an enumerator that iterates through a collection. (Inherited from IEnumerable.)
Top
  Name Description
Public Extension Method AsParallel Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension Method Supported by Portable Class Library AsQueryable Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library Cast<TResult> Converts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OfType<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, 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>.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ