Why does C# not implement GetHashCode for Collections?
Posted
by Peterdk
on Stack Overflow
See other posts from Stack Overflow
or by Peterdk
Published on 2010-05-25T18:27:31Z
Indexed on
2010/05/25
18:31 UTC
Read the original article
Hit count: 289
I am porting something from Java to C#. In Java the hashcode
of a ArrayList
depends on the items in it. In C# I always get the same hashcode from a List
...
Why is this?
For some of my objects the hashcode needs to be different because the objects in their list property make the objects non-equal. I would expect that a hashcode is always unique for the object's state and only equals another hashcode when the object is equal. Am I wrong?
© Stack Overflow or respective owner