Delen via


IEnumerableExtensions.Batch<TSource> Method

Definition

Batches an enumerable into batches of the specified size.

public static System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<TSource>> Batch<TSource> (this System.Collections.Generic.IEnumerable<TSource> source, int batchSize = 10);
static member Batch : seq<'Source> * int -> seq<seq<'Source>>
<Extension()>
Public Iterator Function Batch(Of TSource) (source As IEnumerable(Of TSource), Optional batchSize As Integer = 10) As IEnumerable(Of IEnumerable(Of TSource))

Type Parameters

TSource

The source type/

Parameters

source
IEnumerable<TSource>

The enumerable to batch.

batchSize
Int32

The batch size.

Returns

Applies to