Tutorial by Examples

A string representation of a Guid can be obtained by using the built in ToString method string myGuidString = myGuid.ToString(); Depending on your needs you can also format the Guid, by adding a format type argument to the ToString call. var guid = new Guid("7febf16f-651b-43b0-a5e3-0da8da4...
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 = n...
Like other value types, GUID also has a nullable type which can take null value. Declaration : Guid? myGuidVar = null; This is particularly useful when retrieving data from the data base when there is a possibility that value from a table is NULL.

Page 1 of 1