Information
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.

Uri::Fragment Property

 

Gets the escaped URI fragment.

Namespace:   System
Assembly:  System (in System.dll)

public:
property String^ Fragment {
	String^ get();
}

Property Value

Type: System::String^

A String that contains any URI fragment information.

Exception Condition
InvalidOperationException

This instance represents a relative URI, and this property is valid only for absolute URIs.

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.

// Create Uri
Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm#search" );
Console::WriteLine( uriAddress->Fragment );
Console::WriteLine( "Uri {0} the default port ", uriAddress->IsDefaultPort ? (String^)"uses" : "does not use" );

Console::WriteLine( "The path of this Uri is {0}", uriAddress->GetLeftPart( UriPartial::Path ) );
Console::WriteLine( "Hash code {0}", uriAddress->GetHashCode() );

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: