title: Get caller method from extension method
body: <p>I've a little problem with getting the caller for my extension method.</p>
  
  <p>Searched the internet but couldn't find anything simular to my problem.
  <a href="https://stackoverflow.com/questions/7839691/gettype-in-static-method">This question</a> was a close call... </p>
  
  <p>I've a extension method :</p>
  
  <pre><code>public static void TabToNextField(this FrameworkElement i, FrameworkElement nextField)
  {
     i.KeyPress(Keys.Tab);
     var isNextFieldFocused = nextField.GetProperty&lt;bool&gt;("IsFocused");
  
     if (!isNextFieldFocused)
     {
         //Taborder is incorrect. Next field wasn't focused!
         //This wont work since 'this' can't be used in a static context.
         var currentProcedure = this.GetType().Name;   
         var fromField = i.AutomationId;
         var toField = nextField.AutomationId;
         //Log to file..
     }
  }
  </code></pre>
  
  <p>This is used for some automated tests to validate if the nextfield has focus and the tab order is correct. But for the error that should be logged i would like to get the Class name of the caller to get a accurate report that we can directly see where the error is in our application.</p>
  
  <p>Since all the controls are using AutomationId the controls are easy to identify..</p>
  
  <p>So the question is: <strong>How can i get the caller method from this extension method?</strong></p>