//create stackcrawlmark StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; //do some processing here //check the previous method StackTrace st = new StackTrace(stackMark); StackFrame frame = st.GetFrame(0); string previousMethod = frame.GetMethod().Name;
public void SomeMethod() { //create stackcrawlmark StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller; //do some processing here //check the calling method StackTrace st = new StackTrace(stackMark); StackFrame frame = st.GetFrame(1); string callingMethod = frame.GetMethod().Name; }These examples use the System.Threading namespace of C#.