ObjectBase: GetHashCode

GetHashCode

Returns a hashcode for the specified object instance.



 Public Function GetHashCode(
	  ByVal Obj As IObject ) As Long

Parameters

Obj
[ByVal] IObject. The object to generate the hashcode for.

Return Values

Long -  Returns a Long as the representation of the hashcode.

Remarks

The implementer of the IObject interface can use this method as the default behavior, or create custom behavior using their own logic.

Examples

This example shows the typical implementation of the IObject interface using the MyBase methods for default behavior.

Option Explicit
Implements IObject


Public Function Equals(ByRef Value As Variant) As Boolean
    Equals = MyBase.Equals(Me, Value)
End Function

Public Function GetHashCode() As Long
    GetHashCode = MyBase.GetHashCode(Me)
End Function

Public Function ToString() As String
    ToString = MyBase.ToString(Me, App)
End Function


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'   IObject
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function IObject_Equals(Value As Variant) As Boolean
    IObject_Equals = Equals(Value)
End Function

Private Function IObject_GetHashCode() As Long
    IObject_GetHashCode = GetHashCode
End Function

Private Function IObject_ToString() As String
    IObject_ToString = ToString
End Function

See Also

Project CorLib Overview

Class ObjectBase Overview