title: How We Can get the async Method Name In c#
body: <p>I want to get the name of this method by using <strong>Reflection</strong> etc...I use a lot of stuff but I 'm tired please help me.
  If the function is sync then it below code will work fine. Please go through the below code, that will clear you my question.</p>
  
  <pre><code>// this will work fine
  public void Test()
  {
  // This GetCurrentMethod() will you the name of current method
  string CurrentMethodName = GetCurrentMethod();
  // output will be CurrentMethodName = Test
  }
  
  
  // this will not work
        public async Task&lt;int&gt; GETNumber(long ID)
        {
  // This GetCurrentMethod() will you the name of current method if the method is sync or not async
  string CurrentMethodName = GetCurrentMethod();
             return await Task.Run(() =&gt; { return 20; });
        }
  </code></pre>
  
  <p>This method provide me Name of non async method. but how I get above method  name</p>
  
  <pre><code>&gt;     [MethodImpl(MethodImplOptions.NoInlining)]
  &gt;           public static string GetCurrentMethod()
  &gt;           {
  &gt;                 var stackTrace = new StackTrace();
  &gt;                 StackFrame stackFrame = stackTrace.GetFrame(1);
  &gt;                 return stackFrame.GetMethod().Name;
  &gt;           }
  </code></pre>
  
  <p>But this method is working only for not async method. So how get current async method name in c#</p>