[Mono-list] GetHashCode discussion

Martin Aliger martin_aliger@email.cz
Fri, 8 Mar 2002 10:09:26 +0100 (CET)


Hello,

As I read through GetHasCode discussion I noticed, that some of you note that it must be based on MUTABLE data. It makes sense for me. But others speaks about IMMUTABLE data. Please read once more through Microsoft's man reply - he speaks clearly and it make sense. 

Mutable data is correct answer and if someone add it to hastable, he coudn't change data or he never find it again.

Martin

> So, if equals is based on mutable data and
> gethashcode is based on what
> Equals uses then GetHashCode is also based
> on mutable data. 


>Yes, Object.GetHashCode() must be based on >immutable instance values
>(otherwise you lose objects in hashtables). >But the kicker is that if
>Object.Equals() returns true then the two >object's GetHashCode()s _must_
>be the same !!!


---
   ---------> Created by Email.cz 
   http://www.email.cz <--- Get Your Free Email