Let's say I have a few classes:
MyClass1() {}
MyChild1() : MyClass1 {}
MyChild2() : MyClass2 {}
MyGrandchild1() : MyChild2 {}
etc.
I know that GetHashCode() by itself, does not guarantee uniqueness between any two different Objects, but I'm interested does that apply for any two Types as well? i.e.:
(1) is there a chance that: typeof(MyClass1).GetHashCode() == typeof(MyGrandchild1).GetHashCode()
will return true
?
(2) if there's a chance for (1): is there a chance that typeof(MyClass1) == typeof(MyGrandchild1)
will return true
?
(3) worst case scenario: is there a chance that typeof(int) == typeof(long)
will return true
?
EDIT I forgot to ask about case (4) typeof(int).GetHashCode() == typeof(long).GetHashCode()
, is there a chance for that to return true
?