Get Name of the calling method using Reflection in C#

using System.Diagnostics;
 
// get call stack
StackTrace stackTrace = new StackTrace();
 
// get calling method name
Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.