Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | List of all members
Loyc.Collections.ListAsListSource< T > Class Template Reference

Helper type returned from LCExt.AsListSource<T>. More...


Source file:
Inheritance diagram for Loyc.Collections.ListAsListSource< T >:
Loyc.Collections.IListAndListSource< T > Loyc.Collections.IListAndReadOnly< T > Loyc.Collections.IListSource< T > Loyc.Collections.ICollectionAndSource< T > Loyc.Collections.ICollectionAndReadOnly< T > Loyc.Collections.ICollectionSource< T > Loyc.Collections.ICollectionAndReadOnly< T > Loyc.Collections.IContains< T >

Remarks

Helper type returned from LCExt.AsListSource<T>.

This class implements IList{T} but arguably shouldn't; the IList{T} implementation might be removed in a future version.

Properties

int Count [get]
 
this[int index] [get, set]
 
this[int index, T defaultValue] [get]
 
bool IsReadOnly [get]
 

Public Member Functions

 ListAsListSource (IList< T > obj)
 
bool Contains (T item)
 
TryGet (int index, out bool fail)
 
int IndexOf (T item)
 
Slice_< T > Slice (int start, int count)
 
void Insert (int index, T item)
 
void RemoveAt (int index)
 
void Add (T item)
 
void Clear ()
 
void CopyTo (T[] array, int arrayIndex)
 Copies the elements of the collection to an Array, starting at a particular array index. More...
 
bool Remove (T item)
 
IEnumerator< T > GetEnumerator ()
 
- Public Member Functions inherited from Loyc.Collections.IListSource< T >
IRange< T > Slice (int start, int count=int.MaxValue)
 Returns a sub-range of this list. 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...
 

Member Function Documentation

◆ CopyTo()

void Loyc.Collections.ListAsListSource< T >.CopyTo ( T[]  array,
int  arrayIndex 
)
inline

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

Exceptions
ArgumentNullExceptionarray is null.
ArgumentOutOfRangeExceptionarrayIndex is negative.
ArgumentExceptionThe number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array.

Implements Loyc.Collections.ICollectionSource< T >.