Class EnumerableExtensions
Extensions for IEnumerable
public static class EnumerableExtensions
- Inheritance
-
EnumerableExtensions
- Inherited Members
Methods
Batch<TSource>(IEnumerable<TSource>, int)
Breaks up an IEnumerable into batches.
public static IEnumerable<TSource[]> Batch<TSource>(this IEnumerable<TSource> source, int size)
Parameters
source
IEnumerable<TSource>size
int
Returns
- IEnumerable<TSource[]>
Type Parameters
TSource
SubArray<T>(T[], int, int)
Returns a subset of the source array based on the provided arguments. If offset + maxLength is greater than the length of the source array, then the length of the resulting array will be the difference between the source array length and the offset. For example, calling SubArray with offset = 2 and maxLength = 5 on this array ["a", "b", "c", "d"] will result in ["c", "d"].
public static T[] SubArray<T>(this T[] sourceArray, int offset, int maxLength)
Parameters
sourceArray
T[]The array from which the subset will be pulled
offset
intThe zero-based offset for the starting point of the sub array
maxLength
intThe maximum length of the array to be returned
Returns
- T[]
An array that is a subset of the source array
Type Parameters
T
The type of objects in the array