Sortedset not using custom equals
问题 My class implements IEquatable and IComparable. It then gets added to a sortedset. The goal is to have it be sorted by its "Date" property and be equal if both "ID1" and "ID2" are the same. The implemented methods: public int CompareTo(MyClass other) { return other.Date.CompareTo(Date); } public override int GetHashCode() { unchecked { var hashCode = ID1; hashCode = (hashCode * 397) ^ ID2; return hashCode; } } public bool Equals(MyClass other) { if (ReferenceEquals(null, other)) return false;