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

取消標記以取消該操作。

例外狀況

那是streamnull

取消令牌也被取消了。 此例外會儲存在回傳的任務中。

備註

此方法內部使用 SerializeToStream(Stream, TransportContext, CancellationToken) 序列化內容至指定串流中。 如果內容之前已經被緩衝過,例如呼叫 LoadIntoBufferAsync(),該方法會回傳緩衝後的內容,而不會呼叫序列化方法。

適用於