Return to Snippet

Revision: 22540
at January 14, 2010 15:09 by rengber

Initial Code
protected string Source
      StackTrace st = new StackTrace(true);
      MethodBase mb = st.GetFrame(1).GetMethod(); 
      return mb.ReflectedType.Namespace + "." + mb.ReflectedType.Name + "." + mb.Name; 

//Use like so: 
  public void DoChildStuff()
    Log(Source, "Doing Child Stuff");

Initial URL

Initial Description
GetFrame(1) to avoid the last method being this property accessor.  
Note that in a child class inherited member, the Class name will be the name of the type containing the implementation.

Initial Title
Get the Namespace, Class Name, and Method Name of the Currently Executing Method Via Reflection

Initial Tags

Initial Language