开发者

.NET Base type information?

Is there any convenient function to get a list o开发者_开发知识库f base types of a class. For example, I want to get base types (both interfaces and classes) of ArrayList class. The result should include "Object, IList, ICollection, IEnumerable, and ICloneable"

Please advise.


There can only ever be one base class, no MI in .NET, Type.BaseType. There can be many interfaces, Type.GetInterfaces(). Gluing them together in your preferred format is up to you.


It's not exactly what you're looking for, but in addition to Hans' answer the Type.IsAssignableFrom() method might help you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜