What is the difference between IEqualityComparer and IEquatable?

前端 未结 5 1712
不思量自难忘°
不思量自难忘° 2020-11-30 19:45

I want to understand the scenarios where IEqualityComparer and IEquatable should be used. The MSDN documentation for both looks very similar.

5条回答
  •  没有蜡笔的小新
    2020-11-30 20:20

    One compares two Ts. The other can compare itself to other Ts. Usually, you'll only need to use one at at time, not both.

提交回复
热议问题