[ACCEPTED]-How to get the current class' name in a static method?-static
Accepted answer
new StackFrame().GetMethod().DeclaringType
or
MethodBase.GetCurrentMethod().DeclaringType
or
new StackTrace(true).GetFrame(<frame index>).GetMethod() //e.g. <frame index> = 0
0
Use typeof:
string className = typeof(MyClass).Name;
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.