A string containing any fragment information contained in the URI used to construct the current instance.
The Uri.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 Uri.Fragment property would return #main.
The Uri.Fragment property is not considered in any 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