Enumerable.Chunk<TSource>(IEnumerable<TSource>, Int32) Metoda

Definicja

Dzieli elementy sekwencji na fragmenty o rozmiarze najwyżej size.

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

Parametry typu

TSource

Typ elementów elementu source.

Parametry

source
IEnumerable<TSource>

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

size
Int32

Maksymalny rozmiar każdego fragmentu.

Zwraca

IEnumerable<TSource[]>

Element IEnumerable<T> zawierający elementy, które sekwencja wejściowa podzielona na fragmenty o rozmiarze size.

Wyjątki

source to null.

size jest poniżej 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

Zobacz też