Dela via


HttpFormUrlEncodedContent Constructor

Definition

Initializes a new instance of the HttpFormUrlEncodedContent class with the specified content.

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)))

Parameters

content

IIterable<IKeyValuePair<String,String>>

IEnumerable<KeyValuePair<String,String>>

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

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

The content used to initialize the HttpFormUrlEncodedContent.

Examples

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" }}
};

Remarks

Below are the exceptions that this function throws.

E_INVALIDARG

The content parameter is null (Nothing in Visual Basic).

Applies to