Table of Contents

Class IntRangeExtensions

Extension methods involving IntRange.

public static class IntRangeExtensions
Inheritance
IntRangeExtensions
Inherited Members

Methods

GetRange<T>(IReadOnlyList<T>, IntRange)

Lazily iterates over the indices in the IntRange and yields the IReadOnlyList<T>'s element at that position.

public static IEnumerable<T> GetRange<T>(this IReadOnlyList<T> list, IntRange indices)

Parameters

list IReadOnlyList<T>
indices IntRange

The range of indices to iterate over.

Returns

IEnumerable<T>

Type Parameters

T

Exceptions

ArgumentNullException

list is empty.

Next(Random, IntRange)

Returns a random integer within the given range.

public static int Next(this Random random, IntRange range)

Parameters

random Random
range IntRange

Returns

int

Range(IEnumerable<int>)

Returns the smallest IntRange containing all the given values.

public static IntRange Range(this IEnumerable<int> integers)

Parameters

integers IEnumerable<int>

Returns

IntRange

The smallest IntRange containing all the given values. It will be expressed with both boundaries inclusive, unless the sequence of values is empty, in which case it will be expressed with both boundaries exclusive.

Exceptions

ArgumentNullException

integers is null.