First, you don't need to implement the IEqualityComparer(Of T)
interface; you would normally implement that in another class if you wanted to provide multiple types of equality for the same class.
Second, you'll need to override the GetHashCode
and Equals(Object)
methods:
Partial Public Class CustomerData
Implements IEquatable(Of CustomerData)
Public Override Function GetHashCode() As Integer
Return CustomerID.GetHashCode()
End Function
Public Override Function Equals(ByVal obj As Object)
Return Equals(TryCast(obj, CustomerData))
End Function
Public Overloads Function Equals(other As CustomerData) As Boolean Implements IEquatable(Of ToolData.CustomerData).Equals
If other Is Nothing Then
Return False
Else
Return Me.CustomerID = other.CustomerID
End If
End Function
...
Here's a blog post which explains why: http://blogs.msdn.com/b/jaredpar/archive/2009/01/15/if-you-implement-iequatable-t-you-still-must-override-object-s-equals-and-gethashcode.aspx