HttpContent.CopyTo(Stream, TransportContext, CancellationToken) 方法

定義

將 HTTP 內容序列化成位元組資料流,然後複製到 stream

public:
 void CopyTo(System::IO::Stream ^ stream, System::Net::TransportContext ^ context, System::Threading::CancellationToken cancellationToken);
public void CopyTo (System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken);
member this.CopyTo : System.IO.Stream * System.Net.TransportContext * System.Threading.CancellationToken -> unit
Public Sub CopyTo (stream As Stream, context As TransportContext, cancellationToken As CancellationToken)

參數

stream
Stream

目標資料流。

context
TransportContext

傳輸相關資訊 (例如通道繫結權杖)。 此參數可以是 null

cancellationToken
CancellationToken

用於取消作業的取消權杖。

例外狀況

stream 以前是 null

取消標記已取消。 此例外狀況會儲存在傳回的工作中。

備註

這個方法會在內部使用 SerializeToStream(Stream, TransportContext, CancellationToken) ,將內容串行化為指定的數據流。 例如,如果先前已緩衝內容,藉由呼叫 LoadIntoBufferAsync(),方法會傳回緩衝的內容,而不是呼叫串行化方法。

適用於