HttpContent.CopyToAsync 方法

定義

將 HTTP 內容序列化成位元組資料流,然後複製到 stream 參數所提供的資料流物件。Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the stream parameter.

多載

CopyToAsync(Stream)

將 HTTP 內容序列化成位元組資料流,然後複製到 stream 參數所提供的資料流物件。Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the stream parameter.

CopyToAsync(Stream, TransportContext)

將 HTTP 內容序列化成位元組資料流,然後複製到 stream 參數所提供的資料流物件。Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the stream parameter.

備註

這種操作不會封鎖。This operation does not block.

CopyToAsync(Stream)

將 HTTP 內容序列化成位元組資料流,然後複製到 stream 參數所提供的資料流物件。Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the stream parameter.

public:
 System::Threading::Tasks::Task ^ CopyToAsync(System::IO::Stream ^ stream);
public System.Threading.Tasks.Task CopyToAsync (System.IO.Stream stream);
member this.CopyToAsync : System.IO.Stream -> System.Threading.Tasks.Task

參數

stream
Stream

目標資料流。The target stream.

傳回

工作物件,表示非同步作業。The task object representing the asynchronous operation.

備註

這項作業不會封鎖。This operation will not block. 傳回Task的物件將會在所有內容都寫入stream做為參數傳遞的資料流程物件後完成。The returned Task object will complete after all of the content has been written to the stream object passed as the stream parameter.

CopyToAsync(Stream, TransportContext)

將 HTTP 內容序列化成位元組資料流,然後複製到 stream 參數所提供的資料流物件。Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the stream parameter.

public:
 System::Threading::Tasks::Task ^ CopyToAsync(System::IO::Stream ^ stream, System::Net::TransportContext ^ context);
public System.Threading.Tasks.Task CopyToAsync (System.IO.Stream stream, System.Net.TransportContext context);
member this.CopyToAsync : System.IO.Stream * System.Net.TransportContext -> System.Threading.Tasks.Task

參數

stream
Stream

目標資料流。The target stream.

context
TransportContext

傳輸的相關資訊 (例如通道繫結權杖)。Information about the transport (channel binding token, for example). 此參數可以是 nullThis parameter may be null.

傳回

工作物件,表示非同步作業。The task object representing the asynchronous operation.

備註

這項作業不會封鎖。This operation will not block. 傳回Task的物件將會在所有內容都寫入stream做為參數傳遞的資料流程物件後完成。The returned Task object will complete after all of the content has been written to the stream object passed as the stream parameter.

適用於