Uri.Fragment Eigenschaft

Definition

Ruft das mit Escapezeichen versehene URI-Fragment ab.Gets the escaped URI fragment.

public:
 property System::String ^ Fragment { System::String ^ get(); };
public string Fragment { get; }
member this.Fragment : string
Public ReadOnly Property Fragment As String

Eigenschaftswert

String

URI fragment information.

Ausnahmen

Diese Instanz stellt einen relativen URI dar, diese Eigenschaft ist jedoch nur für absolute URIs gültig.This instance represents a relative URI, and this property is valid only for absolute URIs.

Beispiele

Im folgenden Beispiel wird eine Uri -Instanz erstellt und die Fragmentinformationen in die Konsole geschrieben.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() );
// The example displays output similar to the following:
//        #search
//        Uri uses the default port
//        The path of this Uri is http://www.contoso.com/index.htm
//        Hash code -988419291
// Create Uri
Uri uriAddress = new Uri("http://www.contoso.com/index.htm#search");
Console.WriteLine(uriAddress.Fragment);
Console.WriteLine("Uri {0} the default port ", uriAddress.IsDefaultPort ? "uses" : "does not use");

Console.WriteLine("The path of this Uri is {0}", uriAddress.GetLeftPart(UriPartial.Path));
Console.WriteLine("Hash code {0}", uriAddress.GetHashCode());
// The example displays output similar to the following:
//        #search
//        Uri uses the default port
//        The path of this Uri is http://www.contoso.com/index.htm
//        Hash code -988419291
' Create Uri
Dim uriAddress As New Uri("http://www.contoso.com/index.htm#search")
Console.WriteLine(uriAddress.Fragment)
Console.WriteLine("Uri {0} the default port ", If(uriAddress.IsDefaultPort, "uses", "does not use")) 

Console.WriteLine("The path of this Uri is {0}", uriAddress.GetLeftPart(UriPartial.Path))
Console.WriteLine("Hash code {0}", uriAddress.GetHashCode())
' The example displays output similar to the following:
'        #search
'        Uri uses the default port
'        The path of this Uri is http://www.contoso.com/index.htm
'        Hash code -988419291

Hinweise

Die-Eigenschaft ruft den Fragment Text ab, der auf einen fragmentmarker (#) im URI folgt, einschließlich des fragmentmarkers selbst.The Fragment property gets any text following a fragment marker (#) in the URI, including the fragment marker itself. Wenn der URI angegeben http://www.contoso.com/index.htm#main ist, würde die- Fragment Eigenschaft #Main zurückgeben.Given the URI http://www.contoso.com/index.htm#main, the Fragment property would return #main.

Die- Fragment Eigenschaft wird in keinem Equals Vergleich berücksichtigt.The Fragment property is not considered in any Equals comparison.

Gilt für: