How to create GUID in C#?

 Admin   
290 View    Jan 19 2020 12:34AM

  1. Directly From Visual Studio

    Open Visual Studio->Tools->Create GUID->Registry Format->New GUID.

    It will create a new GUID every time you click New GUID.
  1. In Console Application

The GUID method System.Guid.NewGuid() initializes a new instance of the GUID class.

 

using System;  
namespace GUIDTest {  
    class MainClass {  
        static void Main(string[] args) {  
            System.Guid guid = System.Guid.NewGuid();  
            Console.WriteLine(guid.ToString());  
            Console.ReadLine();  
        }  
    }  
 

 

Name
Comments