Class UriExtensions
Extension methods for the Uri type.
Inherited Members
Namespace: Recore
Assembly: Recore.dll
Syntax
public static class UriExtensions
Methods
| Improve this Doc View SourceAsAbsoluteUri(Uri)
Returns an instance of AbsoluteUri with the same value as uri
if it is absolute, or null if it is relative.
Declaration
public static AbsoluteUri AsAbsoluteUri(this Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri |
Returns
Type | Description |
---|---|
AbsoluteUri |
Remarks
Because an instance of Uri may be neither AbsoluteUri nor RelativeUri,
patterns like (AbsoluteUri)uri
or uri as AbsoluteUri
cannot be used reliably.
AsAbsoluteUri(Uri) works as uri as AbsoluteUri
would if Uri were an abstract base class.
It complements IsAbsoluteUri in this regard.
AsRelativeUri(Uri)
Returns an instance of AbsoluteUri with the same value as uri
if it is absolute, or null if it is relative.
Declaration
public static RelativeUri AsRelativeUri(this Uri uri)
Parameters
Type | Name | Description |
---|---|---|
Uri | uri |
Returns
Type | Description |
---|---|
RelativeUri |
Remarks
Because an instance of Uri may be neither AbsoluteUri nor RelativeUri,
patterns like (AbsoluteUri)uri
or uri as AbsoluteUri
cannot be used reliably.
AsRelativeUri(Uri) works as uri as RelativeUri
would if Uri were an abstract base class.