Guid |
IComparable | |
IFormattable | |
IObject |
Name | Description |
---|---|
Handle (get) | Returns a pointer to the internal GUID structure. |
IsReadOnly (get) | Returns if the guid is read-only. |
Name | Description |
---|---|
CompareTo | Compares this guid to another. |
Equals | Returns a boolean indicating if the value and this object instance are the same instance. |
GetHashCode | Returns a pseudo-unique number identifying this instance. |
ToByteArray | Returns the guid value has an array of bytes. |
ToString | Returns a string representation of guid value. |
A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.
A new Guid can be created using the NewGuid method or one of the factory methods in GuidStatic.
Note |
---|
The VBCorLib Guid conflicts with a hidden type in Visual Basic. In order to specify the VBCorLib version of Guid, a variable can be defined as CorLib.Guid instead of just Guid. Alternatively, moving the reference priority for the VBCorLib library above OLE Automation will give CorLib.Guid priority when a variable is declared. |
The code parses a guid string then displays the guid in various formats.
Private Sub Main() Dim g As Guid Set g = Guid.Parse("{533217B3-CDEC-40A2-B01C-1EA8593B850F}") Debug.Print "Display guid with various formats." Debug.Print " D = " & g.ToString("D") Debug.Print " B = " & g.ToString("B") Debug.Print " P = " & g.ToString("P") Debug.Print " N = " & g.ToString("N") Debug.Print " X = " & g.ToString("X") End Sub ' This code produces the following output. ' ' Display guid with various formats. ' D = 533217b3-cdec-40a2-b01c-1ea8593b850f ' B = {533217b3-cdec-40a2-b01c-1ea8593b850f} ' P = (533217b3-cdec-40a2-b01c-1ea8593b850f) ' N = 533217b3cdec40a2b01c1ea8593b850f ' X = {0x533217b3,0xcdec,0x40a2,{0xb0,0x1c,0x1e,0xa8,0x59,0x3b,0x85,0x0f}}