.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.
精彩评论