[Edit]
+
0
-
0

C# get current method name

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
using System; using System.Diagnostics; using System.Reflection; public static class Program { private static void DoMethod() { StackTrace trace = new StackTrace(); StackFrame frame = trace.GetFrame(0); MethodBase method = frame.GetMethod(); Console.WriteLine("Currently called method name is " + method.Name + "."); } public static void Main(string[] args) { DoMethod(); } }