This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal sealed class DynamicEqualityComparer<T> : IEqualityComparer<T> | |
where T : class | |
{ | |
private readonly Func<T, T, bool> _func; | |
public DynamicEqualityComparer(Func<T, T, bool> func) | |
{ | |
DebugCheck.NotNull(func); | |
_func = func; | |
} | |
public bool Equals(T x, T y) | |
{ | |
return _func(x, y); | |
} | |
public int GetHashCode(T obj) | |
{ | |
return 0; // force Equals | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment