I'm considering implementing my own custom hashcode for a given object... and use this as a key
for my dictionary. Since it's possible (likely) that 2 objects will have the same hashcode, what additional operators should I override, and what should that override (conceptually) look like?
myDictionary.Add(myObj.GetHashCode(),myObj);
vs
myDictionary.Add(myObj,myObj);
In other words, does a Dictionary use a combination of the following in order to determine uniqueness and which bucket to place an object in?
Which are more important than others?
- HashCode
- Equals
- ==
- CompareTo()
Is compareTo only needed in the SortedDictionary?