Initializes a new instance of the Guid class based on the value of a specified string.
[Visual Basic] Overloads Public Sub New( _ ByVal g As String _ ) [C#] public Guid( string g ); [C++] public: Guid( String* g ); [JScript] public function Guid( g : String );
Alternatively, the following format is permitted: {0xdddddddd,0xdddd, 0xdddd,{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd},{0xdd}}, where d is a hexadecimal digit. If this format is used, all brackets and commas indicated are required, and all numbers must be prefixed with "0x" as shown. Fewer hexadecimal digits than shown may be used, but no more.
Exception Type | Condition |
---|---|
ArgumentNullException | if g is null. |
FormatException | The length of g is invalid. The length should be 38 if'{' and'}' are used, and 36 otherwise (counting digits and dashes).
The first (or last) character in g is'{' but the last ( or first) character is not'}'. g contains'-' in the wrong places. The expected format is 8 hexadecimal digits followed by a dash, followed by 4 then a dash, followed by 4 then a dash, followed by 4 then a dash, followed by 12. g contains improperly grouped hexadecimal digits. The expected format is 8 hexadecimal digits followed by a dash, followed by 4 then a dash, followed by 4 then a dash, followed by 4 then a dash, followed by 12. Any element in g does not represent a valid hexadecimal number. |
The string may begin and end with braces: "{", and "}."
The following strings are valid for g:
"CA761232-ED42-11CE-BACD-00AA0057B223"
or
"{CA761232-ED42-11CE-BACD-00AA0057B223}"
Guid Structure | Guid Members | System Namespace | Guid Constructor Overload List