Class IReadOnlyListExtensions
- Namespace
- PAC.Extensions
Extension methods for IReadOnlyList<T>.
public static class IReadOnlyListExtensions
- Inheritance
-
IReadOnlyListExtensions
- Inherited Members
Methods
GetRange<T>(IReadOnlyList<T>, int, int)
Lazily iterates over the IReadOnlyList<T>'s elements from position index
(inclusive) to index
+ count
(exclusive).
This is defined even if count
is negative.
public static IEnumerable<T> GetRange<T>(this IReadOnlyList<T> list, int index, int count)
Parameters
list
IReadOnlyList<T>index
intThe index to start iterating from.
count
intThe number of elements to iterate over, starting from
index
. If negative, it will iterate fromindex
backwards.
Returns
- IEnumerable<T>
Type Parameters
T
Exceptions
- ArgumentNullException
list
is empty.
GetRange<T>(IReadOnlyList<T>, Range)
Lazily iterates over the indices in the Range and yields the IReadOnlyList<T>'s element at that position.
public static IEnumerable<T> GetRange<T>(this IReadOnlyList<T> list, Range indices)
Parameters
list
IReadOnlyList<T>indices
RangeThe range of indices to iterate over.
Returns
- IEnumerable<T>
Type Parameters
T
Exceptions
- ArgumentNullException
list
is empty.