AsyncEnumerable.Chunk<TSource> 方法

定义

将序列的元素拆分为大小块,最多 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[]>

一个包含输入序列的元素拆分为大小size区块的元素IAsyncEnumerable<T>

例外

sourcenull

size 小于 1。

注解

除最后一个区块以外的每个区块的大小 size。 最后一个区块将包含剩余的元素,并且大小可能较小。

适用于