Class RangeUtils
Provides extension methods for creating and manipulating ranges on read-only lists.
public static class RangeUtils
- Inheritance
-
RangeUtils
- Inherited Members
Methods
Backward<T>(IReadOnlyList<T>)
Creates a reversed ReadOnlyRange<T> of the entire list.
public static ReadOnlyRange<T> Backward<T>(this IReadOnlyList<T> a)
Parameters
aIReadOnlyList<T>The list to reverse.
Returns
- ReadOnlyRange<T>
A read-only range representing the reversed list.
Type Parameters
TThe type of elements in the list.
Between<T>(IReadOnlyList<T>, int, int)
Creates a ReadOnlyRange<T> between the specified start and end indexes.
public static ReadOnlyRange<T> Between<T>(this IReadOnlyList<T> a, int startIndex, int endIndex)
Parameters
aIReadOnlyList<T>The list to create the range from.
startIndexintThe starting index of the range.
endIndexintThe ending index of the range.
Returns
- ReadOnlyRange<T>
A read-only range of elements between the specified indexes.
Type Parameters
TThe type of elements in the list.
Between<T>(IReadOnlyList<T>, int, int, int)
Creates a ReadOnlyRange<T> between the specified start and end indexes with a custom step.
public static ReadOnlyRange<T> Between<T>(this IReadOnlyList<T> a, int startIndex, int endIndex, int step)
Parameters
aIReadOnlyList<T>The list to create the range from.
startIndexintThe starting index of the range.
endIndexintThe ending index of the range.
stepintThe step value for the range.
Returns
- ReadOnlyRange<T>
A read-only range of elements between the specified indexes with the specified step.
Type Parameters
TThe type of elements in the list.
From<T>(IReadOnlyList<T>, int, int)
Creates a ReadOnlyRange<T> starting from the specified index with an optional step.
public static ReadOnlyRange<T> From<T>(this IReadOnlyList<T> a, int startIndex, int step = 1)
Parameters
aIReadOnlyList<T>The list to create the range from.
startIndexintThe starting index of the range.
stepintThe step value for the range. Default is 1.
Returns
- ReadOnlyRange<T>
A read-only range starting from the specified index.
Type Parameters
TThe type of elements in the list.
To<T>(IReadOnlyList<T>, int, int)
Creates a ReadOnlyRange<T> up to the specified position with an optional step.
public static ReadOnlyRange<T> To<T>(this IReadOnlyList<T> a, int position, int step = 1)
Parameters
aIReadOnlyList<T>The list to create the range from.
positionintThe end index of the range.
stepintThe step value for the range. Default is 1.
Returns
- ReadOnlyRange<T>
A read-only range up to the specified position.
Type Parameters
TThe type of elements in the list.