AsyncStreamingClientResult.Create<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a result whose values are produced from the response content stream.
public static System.ClientModel.AsyncStreamingClientResult<T> Create<T>(System.ClientModel.Primitives.PipelineResponse response, Func<System.IO.Stream,System.Threading.CancellationToken,System.Collections.Generic.IAsyncEnumerable<T>> producer, System.Threading.CancellationToken operationCancellationToken = default);
static member Create : System.ClientModel.Primitives.PipelineResponse * Func<System.IO.Stream, System.Threading.CancellationToken, System.Collections.Generic.IAsyncEnumerable<'T>> * System.Threading.CancellationToken -> System.ClientModel.AsyncStreamingClientResult<'T>
Public Shared Function Create(Of T) (response As PipelineResponse, producer As Func(Of Stream, CancellationToken, IAsyncEnumerable(Of T)), Optional operationCancellationToken As CancellationToken = Nothing) As AsyncStreamingClientResult(Of T)
Type Parameters
- T
The type of values in the stream.
Parameters
- response
- PipelineResponse
An established response containing the stream.
- producer
- Func<Stream,CancellationToken,IAsyncEnumerable<T>>
The function that reads values from the stream. The producer must observe cancellation or stream closure. Otherwise, DisposeAsync() can wait indefinitely for an active read to complete.
- operationCancellationToken
- CancellationToken
The cancellation token for the operation.
Returns
A one-shot asynchronous streaming result.