Class UriExtensions
- Namespace
- TypedRest
- Assembly
- TypedRest.dll
Provides extension methods for Uri.
public static class UriExtensions
- Inheritance
-
UriExtensions
- Inherited Members
Methods
EnsureTrailingSlash(Uri)
Adds a trailing slash to the URI if it does not already have one.
public static Uri EnsureTrailingSlash(this Uri uri)
Parameters
uri
Uri
Returns
ExtractCredentials(Uri)
Extracts credentials from user info in URI if set.
public static NetworkCredential? ExtractCredentials(this Uri uri)
Parameters
uri
Uri
Returns
Join(Uri, string)
Resolves a relative URI using this URI as the base.
public static Uri Join(this Uri baseUri, string relativeUri)
Parameters
baseUri
UriThe base URI to resolve from.
relativeUri
stringThe relative URI to resolve. Prepend
./
to imply a trailing slash inbaseUri
even if it is missing there.
Returns
Examples
Debug.Assert(new Uri("http://myhost/path").Join("./subpath") == new Uri("http://myhost/path/subpath"));
Join(Uri, Uri)
Resolves a relative URI using this URI as the base.
public static Uri Join(this Uri baseUri, Uri relativeUri)
Parameters
baseUri
UriThe base URI to resolve from.
relativeUri
UriThe relative URI to resolve. Prepend
./
to imply a trailing slash inbaseUri
even if it is missing there.
Returns
Examples
Debug.Assert(new Uri("http://myhost/path").Join(new Uri("./subpath", UriKind.Relative)) == new Uri("http://myhost/path/subpath"));