Język

AsyncEnumerable.Chunk<TSource> Metoda

Definicja

Podziel elementy sekwencji na fragmenty rozmiaru na najwyżej 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())

Parametry typu

TSource

Typ elementów źródła.

Parametry

source
IAsyncEnumerable<TSource>

Element IAsyncEnumerable<T> , którego elementy do fragmentowania.

size
Int32

Maksymalny rozmiar każdego fragmentu.

Zwraca

IAsyncEnumerable<TSource[]>

Element IAsyncEnumerable<T> zawierający elementy sekwencji danych wejściowych podzielonych na fragmenty o rozmiarze size.

Wyjątki

Parametr source ma wartość null.

size wartość jest mniejsza niż 1.

Uwagi

Każdy fragment z wyjątkiem ostatniego będzie mieć rozmiar size. Ostatni fragment będzie zawierać pozostałe elementy i może mieć mniejszy rozmiar.

Dotyczy