JsonRpcExtensions.WithPrefetchAsync<T> 方法

定义

预加载 IAsyncEnumerable<T> 一个缓存的预枚举项,以包含在 RPC 通道上可枚举的初始传输中。

public static System.Threading.Tasks.ValueTask<System.Collections.Generic.IAsyncEnumerable<T>> WithPrefetchAsync<T> (this System.Collections.Generic.IAsyncEnumerable<T> enumerable, int count, System.Threading.CancellationToken cancellationToken = default);
static member WithPrefetchAsync : System.Collections.Generic.IAsyncEnumerable<'T> * int * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<System.Collections.Generic.IAsyncEnumerable<'T>>
<Extension()>
Public Function WithPrefetchAsync(Of T) (enumerable As IAsyncEnumerable(Of T), count As Integer, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of IAsyncEnumerable(Of T))

类型参数

T

集合中的项类型。

参数

enumerable
IAsyncEnumerable<T>

要从中预提取项的序列。

count
Int32

要预提取的项数。 如果此值大于可枚举中的元素数,则预提取所有值。

cancellationToken
CancellationToken

取消标记。

返回

一个经过修饰 IAsyncEnumerable<T> 的对象,专为 JSON-RPC 使用预加载的值进行处理。

适用于