I have a class with an interface, which for this I will call ISomething. This class implements IEquatable(of ISomething).

Following this example:

https://docs.microsoft.com/en-us/dot...ramework-4.7.2

I would expect that Contains will use the Equals method to evaluate whether or not a List contains a match, but that doesn't seem to be the case. In the test I was running, the class has a List (of ISomething). In the test example, this list had only one element in it, so I was able to switch between this, which uses Contains:

Code:
                If mSubFilters.Contains(other.GetSubFilter(x)) = False Then
                    Return False
                End If
and this which is just a straight comparison of the one and only elements in both lists:

Code:
                If mSubFilters(0).EqualsOtherISomething(other.GetSubFilter(x)) = False Then
                    Return False
                End If
I did change the name of the method, but that shouldn't matter, as it implements IEquatable(of ISomething).Equals, as it must to implement the interface.
The second code runs correctly, because the two are equal. They are not the same object, they are just the same type with the same values, but one is a copy of the other, so they are different references.

The link I provided suggests that the first block of code should run correctly, because it states that an object that implements Equals (actually IEquatable(of T) in the example), will use that to evaluate whether the sought item is contained in the list. The first block does not run correctly, as it says that the copy is not found in the list, even though it is there, as the second code shows.

Clearly, List.Contains is not using the Equals, but is doing something else. What am I misunderstanding?