Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
struct Microsoft.​AspNetCore.​Http.​PathString
Assembly: Microsoft.AspNetCore.Http.Abstractions
Implemented Interfaces
Provides correct escaping for Path and PathBase values when needed to reconstruct a request or redirect URI string
Fields and Constants
public static readonly
PathString
Empty
Represents the empty path. This field is read-only.
Properties
public
string
Value
The unescaped path value
public
bool
HasValue
True if the path is not empty
Methods
public
string
ToString​()
Provides the path string escaped in a way which is correct for combining into the URI representation.
Returns The escaped path value
public
string
ToUriComponent​()
Provides the path string escaped in a way which is correct for combining into the URI representation.
Returns The escaped path value
public static
PathString
FromUriComponent​(string uriComponent)
Returns an PathString given the path as it is escaped in the URI format. The string MUST NOT contain any
value that is not a path.
Returns The resulting PathString
uriComponent
The escaped path as it appears in the URI format.
public static
PathString
FromUriComponent​(System.​Uri uri)
Returns an PathString given the path as from a Uri object. Relative Uri objects are not supported.
Returns The resulting PathString
uri
The Uri object
public
bool
StartsWithSegments​(PathString other)
Determines whether the beginning of this <see cref="T:Microsoft.AspNetCore.Http.PathString" /> instance matches the specified <see cref="T:Microsoft.AspNetCore.Http.PathString" /> .
Returns true if value matches the beginning of this string; otherwise, false.
other
The <see cref="T:Microsoft.AspNetCore.Http.PathString" /> to compare.
Remarks
When the <paramref name="other" /> parameter contains a trailing slash, the <see cref="T:Microsoft.AspNetCore.Http.PathString" /> being checked
must either exactly match or include a trailing slash. For instance, for a <see cref="T:Microsoft.AspNetCore.Http.PathString" /> of "/a/b",
this method will return <c>true</c> for "/a", but will return <c>false</c> for "/a/".
Whereas, a <see cref="T:Microsoft.AspNetCore.Http.PathString" /> of "/a//b/" will return <c>true</c> when compared with "/a/".
public
bool
StartsWithSegments​(PathString other,
System.​StringComparison comparisonType)
Determines whether the beginning of this <see cref="T:Microsoft.AspNetCore.Http.PathString" /> instance matches the specified <see cref="T:Microsoft.AspNetCore.Http.PathString" /> when compared
using the specified comparison option.
Returns true if value matches the beginning of this string; otherwise, false.
other
The <see cref="T:Microsoft.AspNetCore.Http.PathString" /> to compare.
comparisonType
One of the enumeration values that determines how this <see cref="T:Microsoft.AspNetCore.Http.PathString" /> and value are compared.
Remarks
When the <paramref name="other" /> parameter contains a trailing slash, the <see cref="T:Microsoft.AspNetCore.Http.PathString" /> being checked
must either exactly match or include a trailing slash. For instance, for a <see cref="T:Microsoft.AspNetCore.Http.PathString" /> of "/a/b",
this method will return <c>true</c> for "/a", but will return <c>false</c> for "/a/".
Whereas, a <see cref="T:Microsoft.AspNetCore.Http.PathString" /> of "/a//b/" will return <c>true</c> when compared with "/a/".
public
bool
StartsWithSegments​(PathString other,
System.​StringComparison comparisonType,
PathString& remaining)
public
bool
StartsWithSegments​(PathString other,
PathString& matched,
PathString& remaining)
public
bool
StartsWithSegments​(PathString other,
System.​StringComparison comparisonType,
PathString& matched,
PathString& remaining)
public
PathString
Add​(PathString other)
Adds two PathString instances into a combined PathString value.
Returns The combined PathString value
public
string
Add​(QueryString other)
Combines a PathString and QueryString into the joined URI formatted string value.
Returns The joined URI formatted string value
public
bool
Equals​(PathString other)
Compares this PathString value to another value. The default comparison is StringComparison.OrdinalIgnoreCase.
Returns True if both PathString values are equal
other
The second PathString for comparison.
public
bool
Equals​(PathString other,
System.​StringComparison comparisonType)
Compares this PathString value to another value using a specific StringComparison type
Returns True if both PathString values are equal
other
The second PathString for comparison
comparisonType
The StringComparison type to use
public
bool
Equals​(object obj)
Compares this PathString value to another value. The default comparison is StringComparison.OrdinalIgnoreCase.
Returns True if both PathString values are equal
obj
The second PathString for comparison.
public
int
GetHashCode​()
Returns the hash code for the PathString value. The hash code is provided by the OrdinalIgnoreCase implementation.
Returns The hash code
protected
void
Finalize​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object