Uri.Fragment Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the escaped URI fragment.
Assembly: System (in System.dll)
| Exception | Condition |
|---|---|
| InvalidOperationException | This property is valid only for an absolute Uri instance. |
The Fragment property gets any text following a fragment marker (#) in the URI, including the fragment marker itself. Given the URI http://www.contoso.com/index.htm#main, the Fragment property would return #main.
The Fragment property is not considered in any Equals comparison.
The following example creates a Uri instance and writes the fragment information to the console.