I have a class PinId with Port and Number properties, and I overrode Equals so that two instances with the same port and number compare equal. The compiler warns (CS0659) that I override Equals but not GetHashCode. I ignored it, and now dictionary.ContainsKey(new PinId("A", 5)) returns false even though an equal key was added earlier, while list.Contains with the same object returns true.
Why does the dictionary not find the key, and what does a correct GetHashCode look like?




