Enumerable.Chunk<TSource>(IEnumerable<TSource>, Int32) メソッド

定義

シーケンスの要素を最大 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())

型パラメーター

TSource

sourceの要素の型。

パラメーター

source
IEnumerable<TSource>

チャンクする要素を持つ IEnumerable<T>

size
Int32

各チャンクの最大サイズ。

返品

IEnumerable<TSource[]>

入力シーケンスがサイズsizeのチャンクに分割された要素を含むIEnumerable<T>

例外

sourcenullです。

size は 1 未満です。

注釈

最後のチャンクを除く各チャンクは、サイズ sizeになります。 最後のチャンクには残りの要素が含まれており、サイズが小さい場合があります。

適用対象

こちらもご覧ください