Class KeyEqualityComparer<T, TKey>
Specifies the equality of objects based on the equality of a key extracted from the objects.
public sealed class KeyEqualityComparer<T, TKey> : IEqualityComparer<T> where T : notnull where TKey : notnull
Type Parameters
TThe type of objects to compare.
TKeyThe type of the key to use to determine equality.
- Inheritance
-
objectKeyEqualityComparer<T, TKey>
- Implements
- Extension Methods
Constructors
KeyEqualityComparer(Func<T, TKey>)
Specifies the equality of objects based on the equality of a key extracted from the objects.
public KeyEqualityComparer(Func<T, TKey> keySelector)
Parameters
keySelectorFunc<T, TKey>A function mapping objects to their respective equality keys.
Methods
Equals(T?, T?)
public bool Equals(T? x, T? y)
Parameters
xTyT
Returns
GetHashCode(T)
public int GetHashCode(T obj)
Parameters
objT