Queryable.Chunk<TSource>(IQueryable<TSource>, Int32) Method

Definition

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

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<cli::array <TSource> ^> ^ Chunk(System::Linq::IQueryable<TSource> ^ source, int size);
public static System.Linq.IQueryable<TSource[]> Chunk<TSource> (this System.Linq.IQueryable<TSource> source, int size);
static member Chunk : System.Linq.IQueryable<'Source> * int -> System.Linq.IQueryable<'Source[]>
<Extension()>
Public Function Chunk(Of TSource) (source As IQueryable(Of TSource), size As Integer) As IQueryable(Of TSource())

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IEnumerable<T> whose elements to chunk.

size
Int32

The maximum size of each chunk.

Returns

IQueryable<TSource[]>

An IEnumerable<T> that contains the elements the input sequence split into chunks of size size.

Exceptions

source is null.

size is below 1.

Remarks

Every chunk except the last will be of size size.

The last chunk will contain the remaining elements and may be of a smaller size.

Applies to