Getting parent class' name using Reflection

前端 未结 8 802
后悔当初
后悔当初 2020-12-03 16:30

How can I get the name of the parent class of some class using Reflection?

相关标签:
8条回答
  • 2020-12-03 17:19

    The question above is asking about the Parent Type, which can be retrieved using:

    yourRefVar.GetType().UnderlyingSystemType.Name

    0 讨论(0)
  • 2020-12-03 17:29

    You can use:

    string baseclassName = typeof(MyClass).BaseType.Name;
    
    0 讨论(0)
提交回复
热议问题