HttpMultipartContent 类

定义

提供使用 multipart/* MIME 类型的 HTTP 内容。

public ref class HttpMultipartContent sealed : IIterable<IHttpContent ^>, IClosable, IStringable, IHttpContent
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.IHttpMultipartContentFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Activatable(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 HttpMultipartContent final : IIterable<IHttpContent>, 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.IHttpMultipartContentFactory, 65536, "Windows.Foundation.UniversalApiContract")]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class HttpMultipartContent final : IIterable<IHttpContent>, IClosable, IStringable, IHttpContent
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.IHttpMultipartContentFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Activatable(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 HttpMultipartContent : IEnumerable<IHttpContent>, 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.IHttpMultipartContentFactory), 65536, "Windows.Foundation.UniversalApiContract")]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpMultipartContent : IEnumerable<IHttpContent>, System.IDisposable, IStringable, IHttpContent
function HttpMultipartContent(subtype, boundary)
Public NotInheritable Class HttpMultipartContent
Implements IDisposable, IEnumerable(Of IHttpContent), IHttpContent, IStringable
继承
Object Platform::Object IInspectable HttpMultipartContent
属性
实现

Windows 要求

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

注解

枚举 C# 或 Microsoft Visual Basic 中的集合

可以在 C# 或 Microsoft Visual Basic 中循环访问 HttpMultipartContent 对象。 在许多情况下,例如使用 foreach 语法,编译器会为你执行此强制转换,你无需显式转换为 IEnumerable<IHttpContent> 。 如果需要显式强制转换(例如,如果要调用 GetEnumerator),请使用 IHttpContent 约束强制转换为 IEnumerable<T>

构造函数

HttpMultipartContent()

初始化 HttpMultipartContent 类的新实例。

HttpMultipartContent(String)

使用指定的 MIME 子类型初始化 HttpMultipartContent 类的新实例。

HttpMultipartContent(String, String)

使用指定的 MIME 子类型和边界字符串初始化 HttpMultipartContent 类的新实例。

属性

Headers

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

方法

Add(IHttpContent)

将 HTTP 内容添加到 HttpMultipartContent 实例。

BufferAllAsync()

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

Close()

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

Dispose()

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

First()

获取一个对象,该对象可用于枚举 HttpMultipartContent 对象中的内容。

ReadAsBufferAsync()

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

ReadAsInputStreamAsync()

序列化 HttpMultipartContent 并返回将内容表示为异步操作的输入流。

ReadAsStringAsync()

HttpMultipartContent 作为异步操作序列化为 字符串

ToString()

返回表示当前 HttpMultipartContent 对象的字符串。

TryComputeLength(UInt64)

确定 HttpMultipartContent 是否具有以字节为单位的有效长度。

WriteToStreamAsync(IOutputStream)

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

适用于

另请参阅