HttpStringContent 类

定义

提供使用字符串的 HTTP 内容。

public ref class HttpStringContent sealed : IClosable, IStringable, IHttpContent
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpStringContentFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpStringContent final : IClosable, IStringable, IHttpContent
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpStringContentFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class HttpStringContent final : IClosable, IStringable, IHttpContent
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpStringContentFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpStringContent : System.IDisposable, IStringable, IHttpContent
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpStringContentFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpStringContent : System.IDisposable, IStringable, IHttpContent
function HttpStringContent(content, encoding, mediaType)
Public NotInheritable Class HttpStringContent
Implements IDisposable, IHttpContent, IStringable
继承
Object Platform::Object IInspectable HttpStringContent
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

构造函数

HttpStringContent(String)

使用指定内容初始化 HttpStringContent 类的新实例。

HttpStringContent(String, UnicodeEncoding)

使用指定的内容和编码初始化 HttpStringContent 类的新实例。

HttpStringContent(String, UnicodeEncoding, String)

使用指定的内容、编码和媒体类型初始化 HttpStringContent 类的新实例。

属性

Headers

获取 在 HttpStringContent 上设置的内容标头的集合。

方法

BufferAllAsync()

HttpStringContent 作为异步操作序列化到内存中。

Close()

关闭 HttpStringContent 实例并释放分配的资源。

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。

ReadAsBufferAsync()

HttpStringContent 序列化为异步操作到缓冲区。

ReadAsInputStreamAsync()

序列化 HttpStringContent 并返回一个输入流,该流将内容表示为异步操作。

ReadAsStringAsync()

HttpStringContent 序列化为 字符串 作为异步操作。

ToString()

返回一个表示当前 HttpStringContent 对象的字符串。

TryComputeLength(UInt64)

计算 HttpStringContent 长度(以字节为单位)。

WriteToStreamAsync(IOutputStream)

HttpStringContent 作为异步操作写入输出流。

适用于

另请参阅