Possible Duplicate:
C# getting its own class name
For Visual Studio, I want to create a class template and use a string field that holds the name of a class itself. Is it possible?
For example:
public class MyClass
{
public string TAG = GetClassName(this);
}
When talking about non-static methods use Object.GetType Method which returns the exact runtime type of the instance (a reference to an instance of the Type Class):
When talking about static methods, use MethodBase Class and its GetCurrentMethod Method :
However, see this post on SO for more info on this.