Class GuidUtility
This utility class is designed to make some System.Guid operations easier to work with.
Inheritance
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class GuidUtility
Methods
| Improve this DocTryParse(String, GuidFormats, out Guid)
Converts the string representation of a GUID to its equivalent System.Guid structure.
Declaration
public static bool TryParse(string value, GuidFormats format, out Guid result)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The GUID to convert. |
GuidFormats | format | A bitmask comprised of one or more GuidFormats that specify how the GUID parsing is conducted. |
System.Guid | result | The structure that will contain the parsed value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
This method returns false
if value
is null
or not in a recognized format, and does not throw an exception.
Only 32 digits (NumberFormat); 32 digits separated by hyphens (DigitFormat); 32 digits separated by hyphens, enclosed in brackets (BraceFormat) and 32 digits separated by hyphens, enclosed in parentheses (ParenthesisFormat) is supported.
For more information refer to this page @ StackOverflow: http://stackoverflow.com/questions/968175/what-is-the-string-length-of-a-guid
TryParse(String, out Guid)
Converts the string representation of a GUID to its equivalent System.Guid structure.
Declaration
public static bool TryParse(string value, out Guid result)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The GUID to convert. |
System.Guid | result | The structure that will contain the parsed value. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Remarks
This method returns false
if value
is null
or not in a recognized format, and does not throw an exception.
Default implementation for this overload evaluates only on DigitFormat | BraceFormat | ParenthesisFormat, eg. 32 digits separated by hyphens; 32 digits separated by hyphens, enclosed in brackets and 32 digits separated by hyphens, enclosed in parentheses.
The reason not to include NumberFormat, eg. 32 digits is the possible unintended GUID result of a MD5 string representation.