Intersect with a custom IEqualityComparer using Linq

First of all this is wrong: public bool Equals(MyClass item1, MyClass item2) { return GetHashCode(item1) == GetHashCode(item2); } If the hashcode’s are different for sure the corresponding 2 items are different, but if they’re equal is not guaranteed that the corresponding 2 items are equal. So this is the correct Equals implementation: public bool Equals(MyClass … Read more