Class IntRangeExtensions
- Namespace
- PAC.DataStructures.Extensions
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
listIReadOnlyList<T>indicesIntRangeThe range of indices to iterate over.
Returns
- IEnumerable<T>
Type Parameters
T
Exceptions
- ArgumentNullException
listis empty.
Next(Random, IntRange)
Returns a random integer within the given range.
public static int Next(this Random random, IntRange range)
Parameters
Returns
Range(IEnumerable<int>)
Returns the smallest IntRange containing all the given values.
public static IntRange Range(this IEnumerable<int> integers)
Parameters
integersIEnumerable<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
integersis null.