IEqualityComparer GetHashCode being called but Equals not

前端 未结 4 893
暖寄归人
暖寄归人 2020-12-10 03:47

I have two lists that I am trying to compare. So I have created a class that implements the IEqualityComparer interface, please see below in the bottom section

4条回答
  •  被撕碎了的回忆
    2020-12-10 03:56

    If you want to force the execution of the Equals you can implement it as follows

    public int GetHashCode(FactorPayoffs obj) {
            return 1;
        }
    

提交回复
热议问题