Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


AsyncEnumerable.Chunk<TSource> Method

Definition

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

C#
public static System.Collections.Generic.IAsyncEnumerable<TSource[]> Chunk<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, int size);

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IAsyncEnumerable<TSource>

An IAsyncEnumerable<T> whose elements to chunk.

size
Int32

Maximum size of each chunk.

Returns

IAsyncEnumerable<TSource[]>

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

Exceptions

source is null.

size is less than 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

Termék Verziók
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided), 10
.NET Standard 2.0 (package-provided)