Method Batch
Batch<T>(IEnumerable<T>, int)
Enumerates a sequence in chunks, yielding batches of a certain size to the enumerator.
public static IEnumerable<T[]> Batch<T>(this IEnumerable<T> sequence, int batchSize)
Parameters
sequence
IEnumerable<T>The sequence of items to be enumerated.
batchSize
intThe maximum number of items to include in a batch.
Returns
- IEnumerable<T[]>
A sequence of arrays, with each array containing at most
batchSize
elements.
Type Parameters
T
The type of item in the batch.