Class UriExtensions
- Namespace
- TypedRest
- Assembly
- TypedRest.dll
Provides extension methods for System.Uri.
public static class UriExtensions
- Inheritance
-
objectUriExtensions
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
uriUri
Returns
- Uri
ExtractCredentials(Uri)
Extracts credentials from user info in URI if set.
public static NetworkCredential? ExtractCredentials(this Uri uri)
Parameters
uriUri
Returns
Join(Uri, string)
Resolves a relative URI using this URI as the base.
public static Uri Join(this Uri uri, string relativeUri)
Parameters
uriUrirelativeUristringThe relative URI to resolve. Add a
./prefix here to imply a trailing slash inurieven if it is missing there.
Returns
- Uri
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 uri, Uri relativeUri)
Parameters
uriUrirelativeUriUriThe relative URI to resolve. Add a
./prefix here to imply a trailing slash inurieven if it is missing there.
Returns
- Uri
Examples
Debug.Assert(new Uri("http://myhost/path").Join(new Uri("./subpath", UriKind.Relative)) == new Uri("http://myhost/path/subpath"));