Another way to do this would be to overload the GetHashCode methods, to return a composite key for your object, then compare Object1.GetHashcode with Object2.GetHashCode.
But realistically i would (as stated in the other answers) implement IComparable(Of T).
Edit -- Added sample code
Public Class MyClassA
Private _myVariable As String = String.Empty
Public Property MyProperty() As String
Get
Return "Fooey"
End Get
Set(ByVal value As String)
_myVariable = value
End Set
End Property
Public Overloads Overrides Function GetHashCode() As Integer
Return MyProperty.GetHashCode
End Function
Public Overrides Function Equals(ByVal obj As Object) As Boolean
Return (Me.GetHashCode = obj.GetHashCode)
End Function
End Class
Public Class MyClassB
Private _myVariable As String = String.Empty
Public Property MyProperty() As String
Get
Return "Fooey"
End Get
Set(ByVal value As String)
_myVariable = value
End Set
End Property
Public Overloads Overrides Function GetHashCode() As Integer
Return MyProperty.GetHashCode
End Function
Public Overrides Function Equals(ByVal obj As Object) As Boolean
Return (Me.GetHashCode = obj.GetHashCode)
End Function
End Class
Because you've Overriden (and Overloaded to return the type you want) the Equals Operator, and used the overidden GetHashCode method in it, you can you can do
If MyClassA.Equals(MyClassB) ......
All you then have to do is decide what to put in you GetHashCode method that would allow you to compare one object to another (the composite key).
Hope this helps.