Friday, May 6, 2011

Generate new unique ID using C#

You can use following function to generate new unique ID using C#.

public static string NewUniqueID()
{
    return DateTime.Now.ToString("yyyyMMddHHmmss") + Guid.NewGuid().ToString("N");
}