Generic IEqualityComparer and GetHashCode

后端 未结 6 1540
-上瘾入骨i
-上瘾入骨i 2020-12-31 11:01

Being somewhat lazy about implementing lots of IEqualityComparers, and given that I couldn\'t easily edit class implementations of object being compared, I went with the fol

6条回答
  •  佛祖请我去吃肉
    2020-12-31 11:42

    Nothing would go wrong, but in hash-table based containers, you're going from approx O(1) to O(n) performance when doing a lookup. You'd be better off simply storing everything in a List and brute force searching it for items that fulfil equality.

提交回复
热议问题