title: How do you create an asynchronous method in C#?
body: <p>Every blog post I've read tells you how to consume an asynchronous method in C#, but for some odd reason never explain how to build your own asynchronous methods to consume. So I have this code right now that consumes my method:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private async void button1_Click(object sender, EventArgs e)
  {
      var now = await CountToAsync(1000);
      label1.Text = now.ToString();
  }
  </code></pre>
  
  <p>And I wrote this method that is <code>CountToAsync</code>:</p>
  
  <pre class="lang-cs prettyprint-override"><code>private Task&lt;DateTime&gt; CountToAsync(int num = 1000)
  {
      return Task.Factory.StartNew(() =&gt;
      {
          for (int i = 0; i &lt; num; i++)
          {
              Console.WriteLine("#{0}", i);
          }
      }).ContinueWith(x =&gt; DateTime.Now);
  }
  </code></pre>
  
  <p><strong>Is this, the use of <code>Task.Factory</code>, the best way to write an asynchronous method, or should I write this another way?</strong></p>