I was wondering if it's possible (even via reflection et similia) to get the caller derived-class inside of a called base-class static method.
For example, I've a base-class with a static method defined:
public MyBaseClass {
public static void MyBaseClassStaticMethod() { /** ... **/ }
}
and a derived-from-it class:
public MyDerivedClass : MyBaseClass { }
then I call:
MyDerivedClass.MyBaseClassStaticMethod()
Is it possibile, inside of method MyBaseClassStaticMethod
, to know which is the caller derived type?
(i.e. MyDerivedClass
)
I just need a string...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…