Equals, GetHashCode, EqualityComparers and fuzzy equality

前端 未结 3 1709
离开以前
离开以前 2021-01-20 07:12

For an object with properties A, B, C, D, StartDate and EndDate if I wanted to implement something where any two objects are equal if they have identical A, B and C and over

3条回答
  •  忘掉有多难
    2021-01-20 07:46

    This is not possible.

    Equality in .Net must be transitive, meaning that if a == b and b == c, then a == c.

提交回复
热议问题