Subset<T>

public sealed class Subset<T> : IEnumerable<T>
Create a subset indexer for arrays.
T

Constructors

Subset

#
Create a new subset.
public Subset(
T[]
array,
Base array.
int[]
indices
Indices in subset. This array will be sorted, so do not expect it to be in the same state after calling this constructor.
)

Properties

Array

#
Gets the underlying array.
public T[] Array { get; }

Indices

#
Gets the subset indices.
public IReadOnlyList<int> Indices { get; }

Length

#
Gets the length of the subset.
public int Length { get; }

SubsetItems

#
Enumerate over all items in the array subset.
public IEnumerable<T> SubsetItems { get; }

Indexers

this[]

#
Gets the array item at the given subset index.
public T this[
index
Subset index.
] { get; }
Array item at Subset[index].

Methods

ArrayIndex

#
Gets the array index associated with the given subset index.
public int ArrayIndex(
subsetIndex
)

GetEnumerator

#
Returns an enumerator that iterates through the collection.
public IEnumerator<T> GetEnumerator()
An enumerator that can be used to iterate through the collection.

IsPartOfSubset

#
Test whether the array index is covered by the subset map.
public bool IsPartOfSubset(
arrayIndex
Array index to test.
)
True if index is included in the subset.

SubsetIndex

#
Gets the subset index associated with the given array index.
public int SubsetIndex(
arrayIndex
)
Explicit

IEnumerable.GetEnumerator

#
IEnumerator IEnumerable.GetEnumerator()