Closed vdurante closed 4 years ago
You can try using StackTrace class like in this example:
var st = new StackTrace();
// prints the name of the calling method (frame with index 0 represents the current method, 1 - its caller, etc.)
Console.WriteLine(st.GetFrame(1).GetMethod().Name);
@YuriyIvon thank you. I was trying to avoid using StackTrace and thought maybe with AspectInjector there would be another way around. Thanks.
I am attempting to implement an Aspect/Advice that targets a constructor capable of getting the name of the method that is instantiating an object of that class. Is it possible to do so?