ProgramingTip

기본 클래스에서 하위 클래스 이름을 찾는 방법은 무엇입니까?

bestdevel 2021. 1. 6. 20:51
반응형

기본 클래스에서 하위 클래스 이름을 찾는 방법은 무엇입니까?


에서 run-time, 내부 base class, 어떻게 현재의 아이 클래스 이름을 찾는 방법은?


현재 개체의 유형과 이름을 가져옵니다.

this.GetType().Name

호출

this.GetType()하면 상속하는 기본 클래스에 관계없이 항상 현재 운영 유형을 가져옵니다.


이 시도 :

Type type = this.GetType().UnderlyingSystemType;  
String className = type.Name;  

이 링크에 대한 자세한 예 :

http://blogs.markglibres.com/2010/11/c-retrieve-class-name-of-child.html

참조 URL : https://stackoverflow.com/questions/4774820/how-to-find-the-child-class-name-from-base-class

반응형