Read-only, generic collection of elements. More...
Inherits ICollection< T >.
Public Member Functions | |
ReadOnlyCollection (ICollection< T > collection) | |
Creates a new ReadOnlyCollection wrapping the given collection . More... | |
bool | Contains (T item) |
Determines whether the item is in this collection. More... | |
void | CopyTo (T[] array, int arrayIndex) |
Copies the entire collection to a compatible one-dimensional array , starting at the specified arrayIndex . More... | |
IEnumerator< T > | GetEnumerator () |
Returns an enumerator that iterates through this collection. More... | |
Properties | |
ICollection< T > | Items [get] |
Gets the collection this ReadOnlyCollection wraps. | |
int | Count [get] |
Gets the number of items in this collection. | |
Read-only, generic collection of elements.
This class wraps another collection as a read-only view on it.
This implementation is needed as this is only present in .Net 4.5 and above.
T | Type of elements in this collection. |
ReadOnlyCollection | ( | ICollection< T > | collection | ) |
Creates a new ReadOnlyCollection wrapping the given collection .
collection | Collection to wrap. |
ArgumentNullException | collection is null . |
bool Contains | ( | T | item | ) |
Determines whether the item is in this collection.
item | Item to locate; may be null . |
void CopyTo | ( | T[] | array, |
int | arrayIndex | ||
) |
Copies the entire collection to a compatible one-dimensional array , starting at the specified arrayIndex .
array | Destination array. |
arrayIndex | Zero-based index at which copying begins. |
ArgumentNullException | array is null . |
ArgumentOutOfRangeException | arrayIndex is less than zero. |
ArgumentException | The number of elements in this collection is greater than the available space in array . |
IEnumerator< T > GetEnumerator | ( | ) |
Returns an enumerator that iterates through this collection.