The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WwwFormUrlDecoder class

Parses a URL query string, and exposes the results as a read-only vector (list) of name-value pairs from the query string.


Public NotInheritable Class WwwFormUrlDecoder
    Implements IEnumerable(Of IWwwFormUrlDecoderEntry), _
    IReadOnlyList(Of IWwwFormUrlDecoderEntry)


The WwwFormUrlDecoder class has these types of members:


The WwwFormUrlDecoder class has these constructors.

WwwFormUrlDecoder Creates and initializes a new instance of the WwwFormUrlDecoder class.



The WwwFormUrlDecoder class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

First Gets an iterator that represents the first name-value pair in the current URL query string.
GetAt Gets the name-value pair at the specified index in the current URL query string.
GetFirstValueByName Gets the first name-value pair that has the specified name, as obtained from the constructing Uniform Resource Identifier (URI) query string.
GetMany Gets name-value pairs starting at the specified index in the current URL query string.
IndexOf Gets a value indicating whether the specified IWwwFormUrlDecoderEntry is at the specified index in the current URL query string.



The WwwFormUrlDecoder class has these properties.

PropertyAccess typeDescription



Gets the number of elements contained in the collection.



Gets or sets the element at the specified index.



Gets the number of the name-value pairs in the current URL query string.



Use the WwwFormUrlDecoder class to parse a query string into name-value pairs, based on the number and placement of "&" and "=" symbols. Each name-value pair is represented by an IWwwFormUrlDecoderEntry object, which has a Name property and a Value property (both strings).

Use GetFirstValueByName to find a specific named query string parameter. All languages can use this method. You'd typically use GetFirstValueByName rather than GetAt or Item because the order of items in a query string usually isn't important, whereas the parameter name is the important identifier of the parts of a query. Or, if you're not sure what names exist in the query string, you might enumerate over the complete WwwFormUrlDecoder collection.

The Uri.QueryParsed property returns a complete WwwFormUrlDecoder based on a Uri instance. So if you're using Visual C++ component extensions (C++/CX) or JavaScript code, and you already have a Uri instance, you won't need to construct a new WwwFormUrlDecoder object, the Uri instance already has one. You might construct a WwwFormUrlDecoder if you have a string representing a URL or its query string component from other sources, such as from a Windows.Web.Http API.

Note  This collection is a vector rather than a map in case the original order has any meaning to an implementation, and also because it's legal for the same name to appear in the query string twice, whereas it's not legal for maps to have duplicate keys.

Collection member lists

For .NET usage, WwwFormUrlDecoder has the projected APIs of a generic IReadOnlyList with a IWwwFormUrlDecoderEntry constraint. The APIs that are available for each language are indicated in the member lists.

For JavaScript, WwwFormUrlDecoder has the members shown in the member lists. In addition, WwwFormUrlDecoder supports a length property, members of Array.prototype, and using an index to access items.

.NET usage

.NET code can't use the Windows.Foundation.Uri class (you use System.Uri instead). But .NET code can and should use WwwFormUrlDecoder. Using WwwFormUrlDecoder is simpler and less error-prone than string-splitting on "&" and "=" characters. That gets complicated because of encoding. To use WwwFormUrlDecoder, call the WwwFormUrlDecoder constructor, passing in the Query value from your System.Uri. This initializes a new WwwFormUrlDecoder object. Then use GetFirstValueByName to find a specific named query string parameter. Or, if you don't know what's going to be in the query string, enumerate over the collection to determine the query string parameters that are available.

Use the IWwwFormUrlDecoderEntry interface for the type of the items in the collection (this is how the items are typed by Item, IndexOf and so on). Don't use the WwwFormUrlDecoderEntry class, it isn't available for .NET usage.

WwwFormUrlDecoder also has the projected APIs of a generic IReadOnlyList with a IWwwFormUrlDecoderEntry constraint, but these APIs aren't commonly used.

Note  System.Web.HttpUtility.ParseQueryString isn't available for .NET for Windows Runtime apps. WwwFormUrlDecoder is the recommended replacement for it.

Enumerating the collection in C# or Microsoft Visual Basic

WwwFormUrlDecoder is enumerable, so you can use language-specific syntax such as foreach in C# to enumerate the items in the collection. The compiler does the type-casting for you and you won't need to cast to IEnumerable<IWwwFormUrlDecoderEntry> explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast to IEnumerable<T> with an IWwwFormUrlDecoderEntry constraint.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


Windows::Foundation [C++]



Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

Windows Phone 8


Windows::Foundation [C++]





See also