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
sequenceIEnumerable<T>The sequence of items to be enumerated.
batchSizeintThe maximum number of items to include in a batch.
Returns
- IEnumerable<T[]>
A sequence of arrays, with each array containing at most
batchSizeelements.
Type Parameters
TThe type of item in the batch.