TEnumerable.Chunk<T> Method

Definition

Splits the elements of a sequence into chunks of size at most size .

Delphi
class function Chunk<T>(const source: IEnumerable<T>; size: Integer): IEnumerable<TArray<T>>

Type Parameters

T

The type of the elements of source .

Parameters

source
IEnumerable<T>

A sequence whose elements to chunk.

size
Integer

The maximum size of each chunk.

Returns

IEnumerable<TArray<T>>

A sequence that contains the elements the input sequence split into chunks of size size .

Exceptions

source is nil .

size is below 1.