Table of Contents

Class EnumerableHelper

Namespace
LinqToDB.Common
Assembly
linq2db.dll
public static class EnumerableHelper
Inheritance
EnumerableHelper

Methods

Batch<T>(IEnumerable<T>, int)

Split enumerable source into batches of specified size. Limitation: each batch could be enumerated only once or exception will be generated.

public static IEnumerable<IEnumerable<T>> Batch<T>(IEnumerable<T> source, int batchSize)

Parameters

source IEnumerable<T>

Source collection to split into batches.

batchSize int

Size of each batch. Must be positive number.

Returns

IEnumerable<IEnumerable<T>>

New enumerable of batches.

Type Parameters

T

Type of element in source.