PipeWriter.CopyFromAsync(Stream, CancellationToken) 方法

定义

从指定的流中异步读取字节并将其写入到 PipeWriter 中。Asynchronously reads the bytes from the specified stream and writes them to the PipeWriter.

protected internal virtual System.Threading.Tasks.Task CopyFromAsync (System.IO.Stream source, System.Threading.CancellationToken cancellationToken = default);
abstract member CopyFromAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.CopyFromAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Friend Overridable Function CopyFromAsync (source As Stream, Optional cancellationToken As CancellationToken = Nothing) As Task

参数

source
Stream

将从中复制内容的流。The stream from which the contents will be copied.

cancellationToken
CancellationToken

要监视取消请求的标记。The token to monitor for cancellation requests. 默认值为 NoneThe default value is None.

返回

Task

表示异步复制操作的任务。A task that represents the asynchronous copy operation.

适用于