How to Generate GUID in C#/CSharp

To generate a GUID in C#/CSharp, we make use of GUID class.  Example is given below.

using System;

namespace Hello_World
{

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

            Console.WriteLine(myGuid.ToString());
        }
    }
}
;

 

  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •