แก้ไข

แชร์ผ่าน


AsyncEnumerable.Chunk<TSource> 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::Collections::Generic::IAsyncEnumerable<cli::array <TSource> ^> ^ Chunk(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source, int size);
public static System.Collections.Generic.IAsyncEnumerable<TSource[]> Chunk<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, int size);
static member Chunk : System.Collections.Generic.IAsyncEnumerable<'Source> * int -> System.Collections.Generic.IAsyncEnumerable<'Source[]>
<Extension()>
Public Function Chunk(Of TSource) (source As IAsyncEnumerable(Of TSource), size As Integer) As IAsyncEnumerable(Of TSource())

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