추상 클래스의 정적 메서드에서 현재 클래스의 형식 (이름 문자열은 아니지만 형식 자체)을 어떻게 얻을 수 있습니까?정적 메서드에서 런타임에 현재 클래스 가져 오기?
using System.Reflection; // I'll need it, right?
public abstract class AbstractClass {
private static void Method() {
// I want to get CurrentClass type here
}
}
public class CurrentClass : AbstractClass {
public void DoStuff() {
Method(); // Here I'm calling it
}
}
이 질문은 이것과 매우 유사하다 :
이How to get the current class name at runtime?
그러나, 나는 정적 메서드 내부에서이 정보를 얻을 싶어요.
같은 'System.Diagnostics.StackTrace'를 사용할 수 있습니다 파생 클래스에서 정적 방법 : [GetType을 정적 방법 (http://stackoverflow.com/questions/7839691/gettype- 정적 방법으로) – Zbigniew