Override Hashtable Contains method
Posted on 2006-11-04
Could someone please help solve this problem.
I've got a hashtable, filled with custom objects. The objects have a property that's a string. I am desperetly trying to get the hashtables "Contains" method to work for this property.
I've "Implements IComparable(Of Word)"
Public Overloads Function CompareTo(ByVal other As Word) As Integer _
Implements IComparable(Of Word).CompareTo
Public Overloads Overrides Function Equals(ByVal obj As Object) As Boolean
Return TypeOf obj Is Word AndAlso CType(obj, Word).Word = Me.Word
Public Overloads Shared Function Equals(ByVal objA As Word, ByVal objB As Word) As Boolean
Return objA.Word = objB.Word
And still it doesn't work - despite two objects having the same string, the Contains returns false.
Help very much appreciated, and urgent.