Revision: 22540
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 14, 2010 15:09 by rengber
Initial Code
protected string Source { get { 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
C#