ICollection Interface
The System.Collections.ICollection
interface defines size, enumerators, and synchronization methods for non‑generic collections.
Namespace: System.Collections
Assembly: System.Runtime.dll
Members
Properties
Name | Type | Description |
---|---|---|
Count | int | Gets the number of elements contained in the collection. |
IsSynchronized | bool | Gets a value indicating whether access to the ICollection is synchronized (thread safe). |
SyncRoot | object | Gets an object that can be used to synchronize access to the ICollection . |
Methods
Name | Signature | Description |
---|---|---|
CopyTo | void CopyTo(Array array, int index) |
Copies the elements of the collection to an Array , starting at a particular index. |
GetEnumerator | IEnumerator GetEnumerator() |
Returns an enumerator that iterates through the collection. |
Member Details
Count (Property)
Gets the number of elements contained in the collection.
public int Count { get; }
IsSynchronized (Property)
Indicates whether access to the collection is thread safe.
public bool IsSynchronized { get; }
SyncRoot (Property)
Provides an object that can be used to synchronize access to the collection.
public object SyncRoot { get; }
CopyTo (Method)
Copies the elements of the ICollection
to an Array
, starting at the specified index.
public void CopyTo(Array array, int index);
GetEnumerator (Method)
Returns an enumerator that iterates through the collection.
public IEnumerator GetEnumerator();