Class UriUtility
This utility class is designed to make System.Uri operations easier to work with.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class UriUtility
Properties
| Improve this DocAllUriSchemes
Gets all URI schemes currently supported by the .NET framework.
Declaration
public static IEnumerable<UriScheme> AllUriSchemes { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<UriScheme> | A sequence of all URI schemes currently supported by the .NET framework. |
Methods
| Improve this DocIsProtocolRelativeUri(String)
Determines whether the specified value is a protocol-relative URI string.
Declaration
public static bool IsProtocolRelativeUri(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the protocol-relative URI. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsProtocolRelativeUri(String, String)
Determines whether the specified value is a protocol-relative URI string.
Declaration
public static bool IsProtocolRelativeUri(string value, string relativeReference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the protocol-relative URI. |
| System.String | relativeReference | The relative reference that |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUri(String)
Determines whether the specified value is an absolute URI string from all known URI schemes.
Declaration
public static bool IsUri(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the URI. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUri(String, IEnumerable<UriScheme>)
Determines whether the specified value is an absolute URI string.
Declaration
public static bool IsUri(string value, IEnumerable<UriScheme> uriSchemes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the URI. |
| System.Collections.Generic.IEnumerable<UriScheme> | uriSchemes | A sequence of UriScheme values to use in the validation of the URI. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUri(String, UriKind)
Determines whether the specified value is an URI string from all known URI schemes.
Declaration
public static bool IsUri(string value, UriKind uriKind)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the URI. |
| System.UriKind | uriKind | The type of the URI. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
IsUri(String, UriKind, IEnumerable<UriScheme>)
Determines whether the specified value is an URI string.
Declaration
public static bool IsUri(string value, UriKind uriKind, IEnumerable<UriScheme> uriSchemes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | value | The string value representing the URI. |
| System.UriKind | uriKind | The type of the URI. |
| System.Collections.Generic.IEnumerable<UriScheme> | uriSchemes | A sequence of UriScheme values to use in the validation of the URI. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Parse(String, UriKind)
Converts the specified string representation of an URI value to its System.Uri equivalent, limited to what is specified in the
Declaration
public static Uri Parse(string uriString, UriKind uriKind)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriString | A string containing the URI to convert. |
| System.UriKind | uriKind | The type of the URI. |
Returns
| Type | Description |
|---|---|
| System.Uri | An System.Uri that is equivalent to the value contained in |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| ArgumentEmptyException |
|
Parse(String, UriKind, IEnumerable<UriScheme>)
Converts the specified string representation of an URI value to its System.Uri equivalent, limited to what is specified in the
Declaration
public static Uri Parse(string uriString, UriKind uriKind, IEnumerable<UriScheme> uriSchemes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriString | A string containing the URI to convert. |
| System.UriKind | uriKind | The type of the URI. |
| System.Collections.Generic.IEnumerable<UriScheme> | uriSchemes | A sequence of UriScheme values to use in the parsing of the URI. |
Returns
| Type | Description |
|---|---|
| System.Uri | An System.Uri that is equivalent to the value contained in |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException |
|
| ArgumentEmptyException |
|
TryParse(String, UriKind, IEnumerable<UriScheme>, out Uri)
Converts the specified string representation of an URI value to its System.Uri equivalent, limited to what is specified in the
Declaration
public static bool TryParse(string uriString, UriKind uriKind, IEnumerable<UriScheme> uriSchemes, out Uri result)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriString | A string containing the URI to convert. |
| System.UriKind | uriKind | The type of the URI. |
| System.Collections.Generic.IEnumerable<UriScheme> | uriSchemes | A sequence of UriScheme values to use in the parsing of the URI. |
| System.Uri | result | When this method returns, contains the constructed System.Uri. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
If this method returns true, the new System.Uri is in result.
TryParse(String, UriKind, out Uri)
Converts the specified string representation of an URI value to its System.Uri equivalent.
Declaration
public static bool TryParse(string uriString, UriKind uriKind, out Uri result)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriString | A string containing the URI to convert. |
| System.UriKind | uriKind | The type of the URI. |
| System.Uri | result | When this method returns, contains the constructed System.Uri. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Remarks
If this method returns true, the new System.Uri is in result.