EnumerableObject : IEnumerable<Foo>
wraps a List<Foo>
If EnumerableObject a.SequenceEquals( EnumerableObject b)
, then they are equal.
Therefore, a GetHashCode
must be implemented. The problem is XORing each element in the list will return the same hash code for any list with all and only the same elements, regardless of order. This is Okay in terms of it working, but will result in many collisions, which will slow down retrieval, etc.
What is a good, fast GetHashCode
method for lists of objects that is order dependent?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…