Class IReadOnlyListExtensions
- Namespace
- PAC.Extensions.System.Collections
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
listIReadOnlyList<T>indexintThe index to start iterating from.
countintThe number of elements to iterate over, starting from
index. If negative, it will iterate fromindexbackwards.
Returns
- IEnumerable<T>
Type Parameters
T
Exceptions
- ArgumentNullException
listis 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
listIReadOnlyList<T>indicesRangeThe range of indices to iterate over.
Returns
- IEnumerable<T>
Type Parameters
T
Exceptions
- ArgumentNullException
listis empty.