Uri.Fragment Uri.Fragment Uri.Fragment Uri.Fragment Property

Definición

Obtiene el fragmento de URI de escape.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

Valor de propiedad

String que contiene información del fragmento de URI.A String that contains any URI fragment information.

Excepciones

Esta instancia representa un identificador URI relativo, y esta propiedad sólo es válida para identificadores URI absolutos.This instance represents a relative URI, and this property is valid only for absolute URIs.

Ejemplos

En el ejemplo siguiente se crea una instancia de Uri y se escribe la información de fragmento en la consola.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 the following output:
//        #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 the following output:
//        #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 the following output:
'        #search
'        Uri uses the default port
'        The path of this Uri is http://www.contoso.com/index.htm
'        Hash code -988419291

Comentarios

La propiedad Fragment obtiene cualquier texto que siga a un marcador de fragmento (#) en el URI, incluido el propio marcador de fragmento.The Fragment property gets any text following a fragment marker (#) in the URI, including the fragment marker itself. Dado el URI http://www.contoso.com/index.htm#main, la propiedad Fragment devolvería #main.Given the URI http://www.contoso.com/index.htm#main, the Fragment property would return #main.

La propiedad Fragment no se tiene en cuenta en ninguna comparación Equals.The Fragment property is not considered in any Equals comparison.

Se aplica a