i have a Dictionary of types (Dictionary) with a custom comparer, because we want to store relationships between 2 given types (for a MVVM pattern), and i need help comming up with a way to get custom EqualityComparer to work.
Doing some research i found that the GetHashCode method gets called before the Equals method, how can i get the hashcodes right?, the expected behavior it's that if i try to get a "Square" from my dictionary, and it has a "GeometricShape" already in it, it returns the value of the "GeometricShape", i can't find a way to hash it in a way that i gives the expected result
public class DictionaryComparer : EqualityComparer<Type>
{
public override bool Equals(Type x, Type y)
{
return x.IsAssignableFromType(y);
}
public override int GetHashCode(Type obj)
{
return obj.GetHashCode();
}
}