AsyncEnumerable.Chunk<TSource> 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將序列中的元素拆分為大小最多 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())
類型參數
- TSource
來源元素的類型。
參數
- source
- IAsyncEnumerable<TSource>
一個 IAsyncEnumerable<T> 要分割的元素。
- size
- Int32
每個區塊的最大大小。
傳回
IAsyncEnumerable<TSource[]>
一個 IAsyncEnumerable<T> 包含輸入序列元素,並被拆分為大小 size為 的區塊。
例外狀況
source 是 null。
size 小於1。
備註
除了最後一個區塊外,每個區塊的大小 size都會是 。 最後一塊會包含剩餘的元素,且可能體積較小。