Posted By

wallybh on 03/17/11


Tagged

method Reflection calling


Versions (?)

Get Calling Method using Reflection


 / Published in: C#
 

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

Get the calling method using reflection.

  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);

Report this snippet  

You need to login to post a comment.