| StringComparer: GetHashCode |
Returns a partially unique numeric representation of the value.
Public Function GetHashCode( ByRef Obj As Variant ) As Long
Two values could generate the same hash code, but still not be equal. If two values generate the same hash code then additional comparisons should be done to check for equality.
The example is the implementation used by the StringComparer.Ordinal and StringComparer.OrdinalIgnoreCase implementation.
Private Function StringComparer_GetHashCode(Obj As Variant) As Long
If VarType(Obj) = vbString Then
If mStringComparison = OrdinalIgnoreCase Then
StringComparer_GetHashCode = Object.GetHashCode(UCase$(Obj))
Exit Function
End If
End If
StringComparer_GetHashCode = Object.GetHashCode(Obj)
End Function