开发者

How can I examine the inheritance hierarchy of my c# application at runtime?

开发者 https://www.devze.com 2022-12-21 17:14 出处:网络
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 exten开发者_StackOverf

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 exten开发者_StackOverflow中文版ds (in this case B)?


You can do something like this.

var a = new A();

Console.WriteLine(a.GetType().BaseType);
0

精彩评论

暂无评论...
验证码 换一张
取 消