Gets the fragment component of the URI used to construct the current instance.
A string containing any fragment information contained in the URI used to construct the current instance.
This property is read-only.
The Uri.Fragment property gets any text following a fragment marker ('#') in the URI, including the fragment marker itself. If, when the current instance was constructed, the URI was already escaped or the constructor's dontEscape parameter was set to false , the value returned by this property is escaped.
Note:The Uri.Fragment property is not considered in a Uri.Equals(object) comparison.
The following example demonstrates the use of the Uri.Fragment property.
C# Example
using System; public class UriTest { public static void Main() { Uri baseUri = new Uri("http://www.contoso.com/"); Uri myUri = new Uri(baseUri, "index.htm#main"); Console.WriteLine(myUri.Fragment); } }The output is
#main
Namespace: System
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0