NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Guid Constructor (String)

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
);

Parameters

g
A String that contains a GUID in the following format: hexadecimal digits are arranged in groups of 8, 4, 4, 4, and 12 digits with hyphens between the groups, as follows: dddddddd-dddd-dddd-dddd-dddddddddddd or {dddddddd-dddd-dddd-dddd-dddddddddddd}.

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.

Exceptions

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.

Remarks

The string may begin and end with braces: "{", and "}."

Example

The following strings are valid for g:

"CA761232-ED42-11CE-BACD-00AA0057B223"

or

"{CA761232-ED42-11CE-BACD-00AA0057B223}"

See Also

Guid Structure | Guid Members | System Namespace | Guid Constructor Overload List