StringContent.SerializeToStreamAsync 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
作为一个异步操作,将构造函数中提供的字符串序列化并写入一个 HTTP 内容流。
protected:
override System::Threading::Tasks::Task ^ SerializeToStreamAsync(System::IO::Stream ^ stream, System::Net::TransportContext ^ context, System::Threading::CancellationToken cancellationToken);
C#
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
。
产品 | 版本 |
---|---|
.NET | 5, 6, 7, 8, 9 |