Get Calling Method using Reflection


/ Published in: C#
Save to your folder(s)

Get the calling method using reflection.


Copy this code and paste it in your HTML
  1. using System.Diagnostics;
  2.  
  3. // get call stack
  4. StackTrace stackTrace = new StackTrace();
  5.  
  6. // get calling method name
  7. Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);

URL: http://www.csharp-examples.net/reflection-calling-method-name/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.