C# Guid Guid(Byte[])
Description
Guid Guid(Byte[])
initializes a new instance of the Guid
structure by using the specified array of bytes.
Syntax
Guid.Guid(Byte[])
has the following syntax.
public Guid(
byte[] b
)
Parameters
Guid.Guid(Byte[])
has the following parameters.
b
- A 16-element byte array containing values with which to initialize the GUID.
Example
The following code creates Guid from byte array.
// w w w . j av a 2 s . c o m
using System;
public class Example
{
public static void Main()
{
// Create a GUID with all zeros and compare it to Empty.
Byte[] bytes = new Byte[16];
Guid guid2 = new Guid(bytes);
Console.WriteLine(guid2);
Console.WriteLine("Empty: {0}", guid2 == Guid.Empty);
}
}
The code above generates the following result.