Given a C# Type, Get its Base Classes and Implemented Interfaces

前端 未结 5 618
庸人自扰
庸人自扰 2020-12-10 16:48

I\'m working on a game engine in C#. The class I\'m working on is called CEntityRegistry, and its job is to keep track of the many instances of CEntity

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 17:51

    Type has a property BaseType and a method FindInterfaces.

    https://msdn.microsoft.com/en-us/library/system.type.aspx

    So actually, it almost does have Type.GetAllBaseClassesAndInterfaces, but you have to make two calls instead of one.

提交回复
热议问题