Uri.Fragment Eigenschap
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee wordt het escaped URI-fragment opgehaald, inclusief het voorloopteken '#' als dit niet leeg is.
public:
property System::String ^ Fragment { System::String ^ get(); };
public string Fragment { get; }
member this.Fragment : string
Public ReadOnly Property Fragment As String
Waarde van eigenschap
Informatie over URI-fragmenten.
Uitzonderingen
Dit exemplaar vertegenwoordigt een relatieve URI en deze eigenschap is alleen geldig voor absolute URI's.
Voorbeelden
In het volgende voorbeeld wordt een Uri exemplaar gemaakt en worden de fragmentinformatie naar de console geschreven.
// 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
Opmerkingen
De Fragment eigenschap haalt tekst op na een fragmentmarkering (#) in de URI, inclusief de fragmentmarkering zelf. Gezien de URI http://www.contoso.com/index.htm#mainzou de Fragment eigenschap #main retourneren.
De Fragment eigenschap wordt niet meegenomen in een Equals vergelijking.
Note
De eigenschap bevat het voorloopscheidingsteken (#), terwijl de URI-specificatie (RFC 3986) het fragment herkent als het gedeelte van een URI zonder het scheidingsteken.