Imports System
Imports System.Collections.Generic
' A GUID (Globally Unique Identifier) and a UUID (Universally Unique Identifier)
' are essentially the same, both being 128-bit values used to uniquely identify
' information in computer systems.
Module HashGuidsExample
Sub Main()
' Create a HashSet containing three randomly generated GUIDs.
' Guid.NewGuid() produces a type‑4 GUID.
Dim guids As New HashSet(Of Guid) From {
Guid.NewGuid(),
Guid.NewGuid(),
Guid.NewGuid()
}
' Compute a hash value for the entire set.
' HashCode.Combine(...) is idiomatic .NET for combining values into a single hash.
Dim hash As Integer = HashCode.Combine(guids)
' Print the GUIDs so we can see what was hashed.
Console.WriteLine("GUIDs in the set:")
For Each g In guids
Console.WriteLine(g)
Next
' Print the resulting hash value.
Console.WriteLine(environment.NewLine & "Hash of the GUID set: " & hash)
End Sub
End Module
' run:
'
' GUIDs in the set:
' 91ff001e-3985-421e-8033-0b84b5bd6595
' ea57ea23-dfe5-4743-b94e-82945acdae1a
' dbecc018-2db2-419a-be84-f6f4603c27ca
'
' Hash of the GUID set: 1787992573
'