Uri.GetComponents Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the specified components of the current instance using the specified escaping for special characters.
Assembly: System (in System.dll)
Parameters
- components
- Type: System.UriComponents
A bitwise combination of the UriComponents values that specifies which parts of the current instance to return to the caller.
- format
- Type: System.UriFormat
One of the UriFormat values that controls how special characters are escaped.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | uriComponents is not a combination of valid UriComponents values. |
| InvalidOperationException | This method is valid only for an absolute Uri instance. |
When Query or Fragment is specified alone, the return value includes the delimiter. The Scheme, UserInfo, Host, Port, and Path components do not include the delimiter. For all other UriComponents values, and combinations of values, the delimiters are included in the returned value.
The components are returned in the order that they appear in the URI. For example, if Scheme is specified, it appears first.
Note: