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
sourceIEnumerable<TSource>sizeint
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
sourceArrayT[]The array from which the subset will be pulled
offsetintThe zero-based offset for the starting point of the sub array
maxLengthintThe maximum length of the array to be returned
Returns
- T[]
An array that is a subset of the source array
Type Parameters
TThe type of objects in the array