Show / Hide Table of Contents

Class UriExtensions

Provides extension methods for Uris.

Inheritance
Object
UriExtensions
Namespace: NanoByte.Common.Net
Assembly: NanoByte.Common.dll
Syntax
public static class UriExtensions : Object

Methods

EnsureTrailingSlash(Uri)

Adds a trailing slash to the URI if it does not already have one.

Declaration
public static Uri EnsureTrailingSlash(this Uri uri)
Parameters
Type Name Description
Uri uri
Returns
Type Description
Uri

GetLocalFileName(Uri)

Extracts the file-name portion of an URI and ensures it is a valid file-name on the local OS.

Declaration
public static string GetLocalFileName(this Uri uri)
Parameters
Type Name Description
Uri uri
Returns
Type Description
String

GetRoot(Uri)

Removes everything except the schema, host and port from the URI. Returns the original URI if it is not an absolute URI.

Declaration
public static Uri GetRoot(this Uri uri)
Parameters
Type Name Description
Uri uri
Returns
Type Description
Uri

ReparseAsAbsolute(Uri)

Reparses a URI (generated via conversion) to ensure it is a valid absolute URI.

Declaration
public static Uri ReparseAsAbsolute(this Uri uri)
Parameters
Type Name Description
Uri uri
Returns
Type Description
Uri

ToStringRfc(Uri)

An alternate version of ToString() that produces results escaped according to RFC 2396.

Declaration
public static string ToStringRfc(this Uri uri)
Parameters
Type Name Description
Uri uri
Returns
Type Description
String
In This Article
Back to top Copyright Bastian Eicher