StringContent.SerializeToStreamAsync 方法

定義

以非同步作業方式,將建構函式中提供的字串序列化並寫入 HTTP 內容資料流。

protected:
 override System::Threading::Tasks::Task ^ SerializeToStreamAsync(System::IO::Stream ^ stream, System::Net::TransportContext ^ context, System::Threading::CancellationToken cancellationToken);
protected override System.Threading.Tasks.Task SerializeToStreamAsync (System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken);
override this.SerializeToStreamAsync : System.IO.Stream * System.Net.TransportContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Protected Overrides Function SerializeToStreamAsync (stream As Stream, context As TransportContext, cancellationToken As CancellationToken) As Task

參數

stream
Stream

目標資料流。

context
TransportContext

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

cancellationToken
CancellationToken

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

傳回

工作物件,表示非同步作業。

例外狀況

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

備註

此作業不會封鎖。 當傳 Task 回的物件完成時,整個字串已經寫入 stream 參數。

適用於