Returns a pseudo-unique number to identify this object instance.
Public Function GetHashCode ( ) As Long
A hashcode is used by VBCorLib to help distinguish different instances of objects. The Hashtable uses an objects hashcode to help search for a specific object. Since there is a finite set of numbers, each hashcode is not truly unique. A generated set of hashcodes should produce an evenly distributed set of values for a specific class type.
This should be overridden to provide a value to identify this object instance. Most objects return their location in memory, unless the objects need to be considered the same as other objects. This occurs for both cDateTime and TimeSpan objects for example. All cDateTime objects that have the same date will generate the same hashcode. Same for TimeSpan. If the spans are the same, so are the hashcodes.
A default implementation for this method could be
Public Function GetHashCode() As Long GetHashCode = ObjPtr(CUnk(Me)) End Function
Project VBCorLib Overview Class IObject Overview IObject Properties IObject Methods Equals ToString