GetHashCode Method reliability in Silverlight/WP7.1
Posted
by
abhinav
on Stack Overflow
See other posts from Stack Overflow
or by abhinav
Published on 2011-11-12T09:44:34Z
Indexed on
2011/11/12
9:50 UTC
Read the original article
Hit count: 244
I am attempting to hash and keep(the hash) an object
of type IEnumerable<anotherobject>
which has about a 1000 entries. I'll be generating another such object, but this time I'd like to check for any changes in the values of the entries using the hash codes of the two objects.
Basically, I was wondering if GetHashCode()
is apt for this, both from a performance perspective and reliability perspective (getting different values for different object values and same values for same object values, always).
If I have to override it, what would be a good way to do so, does it always depend on the type of anotherobject
and what Equals
means when comparing two anotherobject
s? Is there a generic way to do it? This concern is because my object can be quite big.
© Stack Overflow or respective owner