I'm envisioning a nice little skit that a Don Box or someone like that could 
pull off on stage.  Don't worry there are no bath-tubs or naked presenters 
involved.  It is along the lines of the typical malevolent computer/robot on 
StarTrek that is defeated by a paradoxical question.  In this case, it is to 
explain the rules of GetHashCode() i.e.:

Kirk: "Com .. puter ... what ... are the rules ... of GetHashCode()?"

Computer: "GetHashCode() must always return the same value.  GetHashCode() must 
return the same value for objects that are equal."

Kirk: "But ... com .. puter, how can GetHashCode() ... always return ... the 
same value if I ... change ... the value of the object .. thereby guaranteeing 
it is no longer equal to ... its ... original value?"

Computer: "GetHashCode() must always return the same value.  GetHashCode() must 
return the same value for objects that are equal.  If the second object's 
equivalence with the first object changes then the objects are no longer equal 
and the second object should return a different hashcode to get the best hash 
lookup performance.  But GetHashCode() *must* always return the same value... 
This is not logical!  Error!  Error!  Kaboom!"

--
Keith

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to