Getting parent class' name using Reflection

前端 未结 8 875
后悔当初
后悔当初 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:06

    I came to this question seeking the class which declares a nested class, which is the DeclaringType.

    this.GetType().DeclaringType.Name
    

    Maybe not what the OP asked, but maybe someone else comes here with the same search criteria as me. ;-)

提交回复
热议问题