One thing that always bugged me, is that I do not see the base type in Visual Studio.
I just stumbled on this, because I tried to cast a System.Windows.Forms.MenuItem to a System.Windows.Forms.Control
In eclipse the “intellisense” (or whatever it is called) shows me while exploring the members of a class for each member from which base class it is inherited.
In Visual Studio I cannot see the base class, even if I use the Objectbrowser or the help.
The only solution I found is to use at runtime:
Console.WriteLine(obj.GetType.BaseType)
Console.WriteLine(obj.GetType.BaseType.BaseType)
Console.WriteLine(obj.GetType.BaseType.BaseType.BaseType)
...
until I reach System.Object().
Is there a way to query the base type tree of a class at Design Time?
You can see this in the Object Browser; if you click the (+) sign in front of the type, there should be a folder called “Base Types” where you can explore what type the type inherits from, and any interfaces that it implements.
There is a setting that controls this; in the tool bar of the Object Browser there is a Settings tool menu; make sure that “Show base types” is checked.