Table of Contents

Class UriExtensions

Namespace
NanoByte.Common.Net
Assembly
NanoByte.Common.dll

Provides extension methods for System.Uris.

public static class UriExtensions
Inheritance
object
UriExtensions

Methods

EnsureTrailingSlash(Uri)

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

[Pure]
public static Uri EnsureTrailingSlash(this Uri uri)

Parameters

uri Uri

Returns

Uri

GetLocalFileName(Uri)

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

[Pure]
public static string GetLocalFileName(this Uri uri)

Parameters

uri Uri

Returns

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.

[Pure]
public static Uri GetRoot(this Uri uri)

Parameters

uri Uri

Returns

Uri

ReparseAsAbsolute(Uri)

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

[Pure]
public static Uri ReparseAsAbsolute(this Uri uri)

Parameters

uri Uri

Returns

Uri

ToStringRfc(Uri)

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

[Pure]
public static string ToStringRfc(this Uri uri)

Parameters

uri Uri

Returns

string