You could also do it by overriding GetHashCode and Equals on your class. These are the methods the dictionary uses to check if two classes are supposed to be the same.