title: How to get the current ASP.NET core controller method name inside the controller using Reflection or another accurate method
body: <p>I want to get the current method name of my <code>ASP.NET Core</code> controller</p>
  
  <p>I have tried getting the method name through reflection: </p>
  
  <pre><code>    [HttpGet]
      public async Task&lt;IActionResult&gt; CreateProcess(int catId)
      {
          string methodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
  </code></pre>
  
  <p>but this gives me a value of <code>MoveNext</code> and not <code>CreateProcess</code></p>
  
  <p>Take note I don't want to use the ViewContext</p>
  
  <pre><code>string methodName = ActionContext.RouteData.Values["action"].ToString();
  </code></pre>
  
  <p>as I lowercase my urls via the startup settings.The above will get me <code>createprocess</code> instead of <code>CreateProcess</code></p>
  
  <p>I preferably want an easy one-liner and not a multiline extension method.</p>