c# - Overriding GetHashCode and Equals on a class because it's used in a dictionary -


i have been asked override gethashcode , equals on particular class because using instances of class key (lookup) in dictionary.

i've noticed class not contain public properties , private fields reference types. public methods , events.

do still need override these methods? haven't seen problem far during testing. how equality tested in scenario? if nothing, default ok?

thanks in advance.

then can use hash of 2 private objects hash.

hash1 ^ hash2; 

and can compare values of read fields equality.

the idea 2 identical objects should equal.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -