Mega Code Archive

 
Categories / C# Book / 02 Essential Types
 

0336 The Guid Struct

The Guid struct represents a globally unique identifier: a 16-byte value. To create a new random Guid, call the static Guid.NewGuid method: using System; class Sample { public static void Main() { Guid g = Guid.NewGuid(); Console.WriteLine(g.ToString()); } } The output: e242fdf8-d6de-42ed-97e8-76e8c6ae6df8