CommonEqualComparer.cs 625 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. namespace SAGA.RevitUtils.MEP
  4. {
  5. public class CommonEqualComparer<T> : IEqualityComparer<T>
  6. {
  7. private Func<T, T, bool> m_func;
  8. public CommonEqualComparer(Func<T, T, bool> func)
  9. {
  10. this.m_func = func;
  11. }
  12. public bool Equals(T x, T y)
  13. {
  14. bool flag = false;
  15. if (this.m_func != null)
  16. {
  17. flag = this.m_func.Invoke(x, y);
  18. }
  19. return flag;
  20. }
  21. public int GetHashCode(T obj)
  22. {
  23. return 0;
  24. }
  25. }
  26. }