views:

34

answers:

1

Given a class like this:

public class A : B<C> {...}

Assume that I know how to find A's class type using reflection. How can I figure out at run time what base class it extends (in this case B)?

+3  A: 

You can do something like this.

var a = new A();

Console.WriteLine(a.GetType().BaseType);
ChaosPandion
Thanks. For some reason I totally couldn't find that BaseType property until just after I'd posted the question. :-P
StriplingWarrior