HttpFormUrlEncodedContent 构造函数

定义

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

public:
 HttpFormUrlEncodedContent(IIterable<IKeyValuePair<Platform::String ^, Platform::String ^> ^> ^ content);
 HttpFormUrlEncodedContent(IIterable<IKeyValuePair<winrt::hstring, winrt::hstring const&>> const& content);
public HttpFormUrlEncodedContent(IEnumerable<KeyValuePair<string,string>> content);
function HttpFormUrlEncodedContent(content)
Public Sub New (content As IEnumerable(Of KeyValuePair(Of String, String)))

参数

content

IIterable<IKeyValuePair<String,String>>

IEnumerable<KeyValuePair<String,String>>

IIterable<IKeyValuePair<Platform::String,Platform::String>>

IIterable<IKeyValuePair<winrt::hstring,winrt::hstring>>

用于初始化 HttpFormUrlEncodedContent 的内容。

示例

auto contentKeyValuePairs{
winrt::single_threaded_map<winrt::hstring, winrt::hstring>(std::map<winrt::hstring, winrt::hstring>{
    { L"firstname", L"Jane" }, { L"lastname", L"Austen" }
})
};
Windows::Web::Http::HttpFormUrlEncodedContent content1{ contentKeyValuePairs };

Windows::Web::Http::HttpFormUrlEncodedContent content2{
    std::map<winrt::hstring, winrt::hstring>{
        { L"firstname", L"Jane" }, { L"lastname", L"Austen" }}
};

注解

下面是此函数引发的异常。

E_INVALIDARG

在 Visual Basic) 中, content 参数为 null (Nothing

适用于