this.GetType().Name
protected string GetThisClassName() { return this.GetType().Name;
public static class Extension
{
public static string NameOf(this object o)
{
return o.GetType().Name;
}
}
And then use like this:
public class MyProgram
{
string thisClassName;
public MyProgram()
{
this.thisClassName = this.NameOf();
}
}
string CurrentClass = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name.ToString();
string CurrentClass = System.Reflection.MethodBase.GetCurrentMethod().Name.ToString();
Комментариев нет:
Отправить комментарий