Creating a Guid C# with Example



Creating a Guid C# with Example

These are the most common ways to create an instance of Guid: 
Creating an empty guid (00000000-0000-0000-0000-000000000000): 
Guid g = Guid.Empty; 
Guid g2 = new Guid(); 
Creating a new (pseudorandom) Guid: 
Guid g = Guid.NewGuid(); 
Creating Guids with a specific value: 
Guid g = new Guid("0b214de7-8958-4956-8eed-28f9ba2c47c6"); 
Guid g2 = new Guid("0b214de7895849568eed28f9ba2c47c6"); 
Guid g3 = Guid.Parse("0b214de7-8958-4956-8eed-28f9ba2c47c6"); 

0 Comment's

Comment Form

Submit Comment