Tuesday, February 10, 2009

Weekly Source Code: Create A GUID In .Net

A GUID is a unique identifier that you can use as a reference since its always unique.

If you need a GUID without writting any code, then visit Get-A-GUID.com which will generate a GUID for you everytime you refresh the webpage.

The code below create a GUID in C# and then display it to the console window:

class Program
static void Main(string[] args)
System.Guid id = System.Guid.NewGuid();

You can also store a GUID to a database, more about that in a future post :-)

PS: Been hectic at work, will write more later.

No comments: