Get BaseTypes of an Assembly by Reflection

101 Views Asked by At

im trying to develop an app. like vs ObjectBrowser and flow was something like this: stackoverflow.com/questions/6939400/create-a-application-like-visual-studio-object-browser

now my problem was i cant find the method for calling all basetypes ... something like: enter image description here

instead i can only see "Object" as BaseType for Class ...

Q: Is there a way I can get all basetypes via reflection?
1

There are 1 best solutions below

2
On BEST ANSWER

Interfaces (IComparable, IStructuralComparable etc.) are not base types, since a base type can be only one (Object in your case). If you want to get all the interfaces implemented use

  Type tp = ... // type of interest

  Type baseType = tp.BaseType; // Base type
  Type[] interfaces = tp.GetInterfaces(); // Interfaces