Skip to content
24 changes: 13 additions & 11 deletions xml/System/Guid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@

## Examples
The following example passes each string listed in the Remarks section to the <xref:System.Guid.%23ctor%28System.String%29> constructor.

[!code-csharp[System.Guid.ctor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor1.cs#1)]

[!INCLUDE[interactive-note](~/includes/csharp-interactive-note-some.md)]

[!code-csharp-interactive[System.Guid.ctor#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor1.cs#1)]
[!code-vb[System.Guid.ctor#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.ctor/vb/ctor1.vb#1)]

]]></format>
Expand Down Expand Up @@ -374,7 +376,7 @@
## Examples
The following example creates a GUID whose string representation is "0000000a-000b-000c-0001-020304050607".

[!code-csharp[System.Guid.Ctor#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor2.cs#2)]
[!code-csharp-interactive[System.Guid.Ctor#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.ctor/cs/ctor2.cs#2)]
[!code-vb[System.Guid.Ctor#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.ctor/vb/ctor2.vb#2)]

]]></format>
Expand Down Expand Up @@ -688,7 +690,7 @@
## Remarks
You can compare a GUID with the value of the <xref:System.Guid.Empty?displayProperty=nameWithType> field to determine whether a GUID is non-zero. The following example uses the <xref:System.Guid.op_Equality%2A> operator to compare two GUID values with <xref:System.Guid.Empty?displayProperty=nameWithType> to determine whether they consist exclusively of zeros.

[!code-csharp[System.Guid.Empty#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs#1)]
[!code-csharp-interactive[System.Guid.Empty#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs#1)]
[!code-vb[System.Guid.Empty#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.empty/vb/empty.vb#1)]

]]></format>
Expand Down Expand Up @@ -905,7 +907,7 @@
## Examples
The following code example creates and displays the values of two <xref:System.Guid> objects.

[!code-csharp[system.guid.newguid#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.newguid/cs/ng.cs#1)]
[!code-csharp-interactive[system.guid.newguid#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.newguid/cs/ng.cs#1)]
[!code-vb[system.guid.newguid#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.newguid/vb/ng.vb#1)]

]]></format>
Expand Down Expand Up @@ -960,7 +962,7 @@
## Examples
The following example uses the <xref:System.Guid.op_Equality%2A> operator to compare two GUID values with <xref:System.Guid.Empty?displayProperty=nameWithType> to determine whether they consist exclusively of zeros.

[!code-csharp[System.Guid.Empty#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs#1)]
[!code-csharp-interactive[System.Guid.Empty#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.empty/cs/empty.cs#1)]
[!code-vb[System.Guid.Empty#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.empty/vb/empty.vb#1)]

]]></format>
Expand Down Expand Up @@ -1149,7 +1151,7 @@ After trimming, the length of the read-only character span is 0.
## Examples
The following example creates a new GUID, converts it to three separate string representations by calling the <xref:System.Guid.ToString%28System.String%29> method with the "B", "D", and "X" format specifiers, and then calls the <xref:System.Guid.Parse%2A> method to convert the strings back to <xref:System.Guid> values.

[!code-csharp[System.Guid.Parse#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseex1.cs#3)]
[!code-csharp-interactive[System.Guid.Parse#3](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseex1.cs#3)]
[!code-vb[System.Guid.Parse#3](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.parse/vb/parseex1.vb#3)]

]]></format>
Expand Down Expand Up @@ -1270,7 +1272,7 @@ The <xref:System.Guid.ParseExact%2A> method requires the read-only character spa
## Examples
The following example calls the <xref:System.Guid.ToString%28System.String%29> method with each of the supported format specifiers to generate an array of strings that represent a single GUID. These are then passed to the <xref:System.Guid.ParseExact%2A> method, which successfully parses only the string that conforms to the "B" format specifier.

[!code-csharp[System.Guid.Parse#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseexactex1.cs#4)]
[!code-csharp-interactive[System.Guid.Parse#4](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/parseexactex1.cs#4)]
[!code-vb[System.Guid.Parse#4](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.parse/vb/parseexactex1.vb#4)]

]]></format>
Expand Down Expand Up @@ -1450,7 +1452,7 @@ Because the `provider` parameter is ignored, you cannot use it to provide a cust
## Examples
The following example calls the <xref:System.Guid.NewGuid%2A> method to create a <xref:System.Guid> value, and then calls the <xref:System.Guid.ToByteArray%2A> method to represent the <xref:System.Guid> value as a byte array. It then displays both values to the console. Finally, it instantiates a new <xref:System.Guid> value from the byte array and calls its <xref:System.Guid.Equals%28System.Guid%29> method to show that the two <xref:System.Guid> values are identical.

[!code-csharp[System.Guid.ToByteArray#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs#1)]
[!code-csharp-interactive[System.Guid.ToByteArray#1](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.tobytearray/cs/tobytearray3.cs#1)]
[!code-vb[System.Guid.ToByteArray#1](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.tobytearray/vb/tobytearray3.vb#1)]

]]></format>
Expand Down Expand Up @@ -1780,7 +1782,7 @@ Because the `provider` parameter is ignored, you cannot use it to provide a cust
## Examples
The following example creates a new GUID, converts it to three separate string representations by calling the <xref:System.Guid.ToString%28System.String%29> method with the "B", "D", and "X" format specifiers, and then calls the <xref:System.Guid.TryParse%2A> method to convert the strings back to <xref:System.Guid> values.

[!code-csharp[System.Guid.Parse#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseex1.cs#2)]
[!code-csharp-interactive[System.Guid.Parse#2](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseex1.cs#2)]
[!code-vb[System.Guid.Parse#2](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.parse/vb/tryparseex1.vb#2)]

]]></format>
Expand Down Expand Up @@ -1888,7 +1890,7 @@ Because the `provider` parameter is ignored, you cannot use it to provide a cust
## Examples
The following example calls the <xref:System.Guid.ToString%28System.String%29> method with each of the supported format specifiers to generate an array of strings that represent a single GUID. These are then passed to the <xref:System.Guid.TryParseExact%2A> method, which successfully parses the string that conforms to the "B" format specifier.

[!code-csharp[System.Guid.Parse#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseexactex1.cs#5)]
[!code-csharp-interactive[System.Guid.Parse#5](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.guid.parse/cs/tryparseexactex1.cs#5)]
[!code-vb[System.Guid.Parse#5](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.guid.parse/vb/tryparseexactex1.vb#5)]

]]></format>
Expand Down