I\'m working with reflection and currently have a MethodBody. How do I check if a specific method is called inside the MethodBody?
Assembly assembly = Assemb
One can use the StackTrace class:
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
System.Diagnostics.StackFrame sf = st.GetFrame(1);
Console.Out.Write(sf.GetMethod().ReflectedType.Name + "." + sf.GetMethod().Name);
The 1 can be adjusted and determines the number of frame you are interested in.