Wouldn't `IEqualityComparer<T>` be enough?