Friday 19 October 2012

Generating a GUID using C#

GUID (Global Unique Identifier) - A GUID is a unique reference number used as an identifier in computer software. GUIDs are usually stored as 128-bit values, and are commonly displayed as 32 hexadecimal digits with groups separated by hyphens, such as 21EC2020-3AEA-1069-A2DD-08002B30309D.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GeneratingGUID
{
    class Program
    {
        public static void Main(string[] args)
        {
            Guid g = Guid.NewGuid();
            Console.WriteLine("GUID: " + g.ToString());
            Console.ReadLine();
        }
    }
}

No comments:

Post a Comment