FragmentString Struct

Provides correct handling for FragmentString value when needed to generate a URI string

Namespace
Microsoft.AspNetCore.Http
Assemblies
  • Microsoft.AspNetCore.Http.Abstractions

Syntax

public struct FragmentString : IEquatable<FragmentString>
struct Microsoft.AspNetCore.Http.FragmentString

Constructors

FragmentString(System.String)

Initialize the fragment string with a given value. This value must be in escaped and delimited format with a leading ‘#’ character.

Arguments:value (System.String) – The fragment string to be assigned to the Value property.
public FragmentString(string value)

Methods

Equals(Microsoft.AspNetCore.Http.FragmentString)
Return type:System.Boolean
public bool Equals(FragmentString other)
Equals(System.Object)
Return type:System.Boolean
public override bool Equals(object obj)
FromUriComponent(System.String)

Returns an FragmentString given the fragment as it is escaped in the URI format. The string MUST NOT contain any value that is not a fragment.

Arguments:uriComponent (System.String) – The escaped fragment as it appears in the URI format.
Return type:Microsoft.AspNetCore.Http.FragmentString
Returns:The resulting FragmentString
public static FragmentString FromUriComponent(string uriComponent)
FromUriComponent(System.Uri)

Returns an FragmentString given the fragment as from a Uri object. Relative Uri objects are not supported.

Arguments:uri (System.Uri) – The Uri object
Return type:Microsoft.AspNetCore.Http.FragmentString
Returns:The resulting FragmentString
public static FragmentString FromUriComponent(Uri uri)
GetHashCode()
Return type:System.Int32
public override int GetHashCode()
ToString()

Provides the fragment string escaped in a way which is correct for combining into the URI representation. A leading ‘#’ character will be included unless the Value is null or empty. Characters which are potentially dangerous are escaped.

Return type:System.String
Returns:The fragment string value
public override string ToString()
ToUriComponent()

Provides the fragment string escaped in a way which is correct for combining into the URI representation. A leading ‘#’ character will be included unless the Value is null or empty. Characters which are potentially dangerous are escaped.

Return type:System.String
Returns:The fragment string value
public string ToUriComponent()

Operators

Equality(Microsoft.AspNetCore.Http.FragmentString, Microsoft.AspNetCore.Http.FragmentString)
Return type:System.Boolean
public static bool operator ==(FragmentString left, FragmentString right)
Inequality(Microsoft.AspNetCore.Http.FragmentString, Microsoft.AspNetCore.Http.FragmentString)
Return type:System.Boolean
public static bool operator !=(FragmentString left, FragmentString right)

Fields

Empty()

Represents the empty fragment string. This field is read-only.

Return type:Microsoft.AspNetCore.Http.FragmentString
public static readonly FragmentString Empty

Properties

Microsoft.AspNetCore.Http.FragmentString.HasValue

True if the fragment string is not empty

Return type:System.Boolean
public bool HasValue { get; }
Microsoft.AspNetCore.Http.FragmentString.Value

The escaped fragment string with the leading ‘#’ character

Return type:System.String
public string Value { get; }