views:

356

answers:

4

How I can get the name of the parent class of some class using Reflection on C#?

+3  A: 
obj.GetType().BaseType.Name
Ngu Soon Hui
+2  A: 

Like so:

typeof(Typ).BaseType.Name
Maximilian Mayerl
+1  A: 

You can use:

string baseclassName = typeof(MyClass).BaseType.Name;
Razzie
A: 
        Type type = obj.GetType();
        Type baseType = type.BaseType;
        string baseName = baseType.Name;
JDunkerley