FakeList<T> Class

Implements an indexer through an IEnumerator<T>.

public class FakeList<T>

Type parameters

T

Constructors

NameDescription
FakeList(IEnumerable<T>)Initializes a new instance of FakeList<T>.
FakeList(IEnumerator<T>)Initializes a new instance of FakeList<T>.

FakeList overloads

FakeList(IEnumerable<T>)

FakeList.cs

Initializes a new instance of FakeList<T>.

public FakeList(IEnumerable<T> collection)
Parameters
collection IEnumerable<T>
The collection to use to implement the indexer.

FakeList(IEnumerator<T>)

FakeList.cs

Initializes a new instance of FakeList<T>.

public FakeList(IEnumerator<T> collection)
Parameters
collection IEnumerator<T>
The enumerator to use to implement the indexer.

Indexers

NameDescription
this[int]Gets the element at the specified index.

this[int]

FakeList.cs

Gets the element at the specified index.

public T this[int index] { get; }

Parameters

index int

Property value

T

Remarks

If index is greater or equal than the last used index, this operation is O(index - lastIndex), else this operation is O(index).