System.Guid.ParseExact Method

Converts the string representation of a GUID to the equivalent Guid structure, provided that the string is in the specified format.

Syntax

public static Guid ParseExact (string input, string format)

Parameters

input
The GUID to convert.
format
One of the following specifiers that indicates the exact format to use when interpreting input: "N", "D", "B", "P", or "X".

Returns

A structure that contains the value that was parsed.

Remarks

The following table shows the accepted format specifiers for the format parameter. "0" represents a digit; hyphens ("-"), braces ("{", "}"), and parentheses ("(", ")") appear as shown.

N

32 digits:

00000000000000000000000000000000

D

32 digits separated by hyphens:

00000000-0000-0000-0000-000000000000

B

32 digits separated by hyphens, enclosed in braces:

{00000000-0000-0000-0000-000000000000}

P

32 digits separated by hyphens, enclosed in parentheses:

(00000000-0000-0000-0000-000000000000)

X

Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces:

{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0