一款简单易用的基础网络通讯组件库。

HttpExtensionsSetFormUrlEncodedContentTRequest 方法

将一个键值对集合按照application/x-www-form-urlencoded格式设置到HttpRequest的内容中

Definition

命名空间: TouchSocket.Http
程序集: TouchSocket.Http (在 TouchSocket.Http.dll 中) 版本:4.1.4.7+7f7e1f78093c99347956e09330d5d7aca1d2bdf2
C#
public static void SetFormUrlEncodedContent<TRequest>(
	this TRequest request,
	IEnumerable<KeyValuePair<string, string>> nameValueCollection
)
where TRequest : HttpRequest

参数

request  TRequest
待设置内容的HttpRequest对象
nameValueCollection  IEnumerableKeyValuePairString, String
包含键值对的集合,将被转换为查询字符串格式

类型参数

TRequest
HttpRequest的类型,使用泛型以支持所有HttpRequest的子类

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型 TRequest 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。

参见