IEqualityComparer的实现要包括GetHashCode

Notes to Implementers

Implementations are required to ensure that if the Equals method returns true for two objects x and y, then the value returned by the GetHashCode method for xmust equal the value returned for y.

 

来源是MSDN,老是忘记掉GetHashCode的返回原则,备忘一下。

发表回复