MultipartFormDataContent.Add 方法

定义

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

重载

Add(HttpContent)

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

Add(HttpContent, String)

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

Add(HttpContent, String, String)

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

Add(HttpContent)

Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

C#
public override void Add (System.Net.Http.HttpContent content);

参数

content
HttpContent

要添加到集合中的 HTTP 内容。

例外

contentnull

适用于

.NET 9 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

Add(HttpContent, String)

Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

C#
public void Add (System.Net.Http.HttpContent content, string name);

参数

content
HttpContent

要添加到集合中的 HTTP 内容。

name
String

要添加的 HTTP 内容的名称。

例外

namenull 或者只包含空格字符。

contentnull

适用于

.NET 9 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

Add(HttpContent, String, String)

Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs
Source:
MultipartFormDataContent.cs

向序列化为多部/窗体数据 MIME 类型的 HttpContent 对象集合添加 HTTP 内容。

C#
public void Add (System.Net.Http.HttpContent content, string name, string fileName);

参数

content
HttpContent

要添加到集合中的 HTTP 内容。

name
String

要添加的 HTTP 内容的名称。

fileName
String

要添加到集合中的 HTTP 内容的文件名。

例外

namenull 或者只包含空格字符。

- 或 -

fileNamenull 或者只包含空格字符。

contentnull

适用于

.NET 9 和其他版本
产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0