# IEqualityComparer<T>.Equals(T, T) 方法

## 定义

``````public:
bool Equals(T x, T y);``````
``public bool Equals (T x, T y);``
``abstract member Equals : 'T * 'T -> bool``
``Public Function Equals (x As T, y As T) As Boolean``

x
T

y
T

## 实施者说明

Equals(T, T)实现需要确保如果方法为两个对象`x` `y` GetHashCode(T)`true`返回，则的方法`x`返回的值必须等于为返回的值`y`.Implementations are required to ensure that if the Equals(T, T) method returns `true` for two objects `x` and `y`, then the value returned by the GetHashCode(T) method for `x` must equal the value returned for `y`.

Equals(T, T)方法为自反、对称和可传递。The Equals(T, T) method is reflexive, symmetric, and transitive. 也就是说，如果用于将`true`对象与其自身进行比较，则返回; 否则返回。`true` `y` `true` `z` 对于两`true``x`对象`y` ，如果它适用于和`x`，则为; `x`对于两个对象，则为; 对于，则为`true``x`和也适用`true`于和`y``z` `y`That is, it returns `true` if used to compare an object with itself; `true` for two objects `x` and `y` if it is `true` for `y` and `x`; and `true` for two objects `x` and `z` if it is `true` for `x` and `y` and also `true` for `y` and `z`.