- How to get the current class' name in a static method?
- new StackFrame().GetMethod().DeclaringType
- MethodBase.GetCurrentMethod().DeclaringType
- new StackTrace(true).GetFrame(<frame index>).GetMethod() //e.g. <frame index> = 0
- string className = typeof(MyClass).Name;
- private MyStaticClass
- {
- // ...
- }
- public static Type MyStaticMethiod()
- {
- return new MyStaticClass().GetType();
- }