System.Guid

System.Guid is a structure for manipulating GUIDs. A GUID is a 128-bit integer that is used to identify objects. A GUID can be used to uniquely identify an object across machines or networks. This identifier has a low probability of being duplicated. The following sample allocates a GUID and prints it in various formats. It then allocates another GUID and compares it with the first. Listing B.7 shows an example of using this structure to manipulate two GUIDs (guid.cs).

Listing B.7. GUID Example
 static void Main(string [] args) { Guid guid = Guid.NewGuid(); Console.WriteLine("Guid: {0} ", guid); Console.WriteLine("Guid: {0} ", guid.ToString("N")); Console.WriteLine("Guid: {0} ", guid.ToString("D")); Console.WriteLine("Guid: {0} ", ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.