Working with GUIDs

How many times do you need to represent something with a unique identifier? Probably your answer is “very often.” Examples are items with the same name but with different characteristics. The .NET Framework enables creating unique identifiers via the System.Guid structure (therefore a value type). Such type enables generating a unique, 128-bit string, identifier. To generate a unique identifier, invoke the Guid.NewGuid method that works as follows:

image

If you run the preceding code, you notice that each time you invoke the NewGuid method a new GUID is generated, although you assign such value to the same variable. This makes sense, ...

Get Visual Basic® 2010 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.