Uri.Fragment Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá řídicí fragment identifikátoru URI, včetně úvodního znaku #, pokud není prázdný.
public:
property System::String ^ Fragment { System::String ^ get(); };
public string Fragment { get; }
member this.Fragment : string
Public ReadOnly Property Fragment As String
Hodnota vlastnosti
Informace o fragmentu identifikátoru URI
Výjimky
Tato instance představuje relativní identifikátor URI a tato vlastnost je platná pouze pro absolutní identifikátory URI.
Příklady
Následující příklad vytvoří Uri instanci a zapíše informace o fragmentu do konzoly.
// 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
let uriAddress = Uri "http://www.contoso.com/index.htm#search"
printfn $"{uriAddress.Fragment}"
printfn $"""Uri {if uriAddress.IsDefaultPort then "uses" else "does not use"} the default port """
printfn $"The path of this Uri is {uriAddress.GetLeftPart UriPartial.Path}"
printfn $"Hash code {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
Poznámky
Vlastnost Fragment získá jakýkoli text za značkou fragmentu (#) v identifikátoru URI, včetně samotné značky fragmentu. Vzhledem k identifikátoru URI http://www.contoso.com/index.htm#mainFragment by vlastnost vrátila #main.
Vlastnost Fragment není považována za žádné Equals porovnání.
Poznámka:
Tato vlastnost obsahuje počáteční oddělovač (#), zatímco specifikace identifikátoru URI (RFC 3986) rozpozná fragment jako část identifikátoru URI bez oddělovače.