Table of Contents

Class RangeUtils

Namespace
Utils.Range
Assembly
Utils.dll

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

a IReadOnlyList<T>

The list to reverse.

Returns

ReadOnlyRange<T>

A read-only range representing the reversed list.

Type Parameters

T

The 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

a IReadOnlyList<T>

The list to create the range from.

startIndex int

The starting index of the range.

endIndex int

The ending index of the range.

Returns

ReadOnlyRange<T>

A read-only range of elements between the specified indexes.

Type Parameters

T

The 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

a IReadOnlyList<T>

The list to create the range from.

startIndex int

The starting index of the range.

endIndex int

The ending index of the range.

step int

The step value for the range.

Returns

ReadOnlyRange<T>

A read-only range of elements between the specified indexes with the specified step.

Type Parameters

T

The 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

a IReadOnlyList<T>

The list to create the range from.

startIndex int

The starting index of the range.

step int

The step value for the range. Default is 1.

Returns

ReadOnlyRange<T>

A read-only range starting from the specified index.

Type Parameters

T

The 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

a IReadOnlyList<T>

The list to create the range from.

position int

The end index of the range.

step int

The step value for the range. Default is 1.

Returns

ReadOnlyRange<T>

A read-only range up to the specified position.

Type Parameters

T

The type of elements in the list.