Enhanced C#
Language of your choice: library documentation
|
A variation of IReadOnlyCollection that provides the Contains() and CopyTo() methods from ICollection. More...
A variation of IReadOnlyCollection that provides the Contains() and CopyTo() methods from ICollection.
Implementing this interface suggests that the collection may support accelerated membership tests (int O(1) or O(log(Count)) time), because if it doesn't, the collection only needs to implement IReadOnlyCollection (relying on extension methods for Contains() and CopyTo()).
The name of this collection fits a pattern: just as IListSource is a variation on IReadOnlyList with additional functionality, this interface is a variation on IReadOnlyCollection with additional functionality. The word "source" means "data comes out"; it is the opposite of a "sink" which means "data goes in".
Public Member Functions | |
void | CopyTo (T[] array, int arrayIndex) |
Copies the elements of the collection to an Array, starting at a particular array index. More... | |
Public Member Functions inherited from Loyc.Collections.IContains< T > | |
bool | Contains (T item) |
Returns true if and only if the collection contains the specified item. More... | |
void Loyc.Collections.ICollectionSource< T >.CopyTo | ( | T[] | array, |
int | arrayIndex | ||
) |
Copies the elements of the collection to an Array, starting at a particular array index.
It's usually more convenient to call the ToArray() extension method, which calls this method for you.
This method exists for performance reasons (the collection itself can often copy data out faster than an enumerator can).
ArgumentNullException | array is null. |
ArgumentOutOfRangeException | arrayIndex is negative. |
ArgumentException | The number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array. |
Implemented in Loyc.Collections.AListBase< K, T >, Loyc.Collections.FVList< T >, Loyc.Collections.VList< T >, Loyc.Collections.WListBase< T >, Loyc.Collections.Impl.InternalList< T >, Loyc.Collections.ListSlice< T >, Loyc.Collections.DList< T >, Loyc.Collections.Repeated< T >, Loyc.Collections.Repeated< T >, Loyc.Collections.ListAsListSource< T >, Loyc.Collections.ReversedList< T >, Loyc.Collections.ListSourceAsList< T >, and Loyc.Collections.Impl.ListExBase< T >.
Referenced by Loyc.Collections.CollectionSource.ToArray< T >().