title: How and when to use ‘async’ and ‘await’
body: <p>From my understanding one of the main things that <a href="https://docs.microsoft.com/en-us/dotnet/csharp/async" rel="noreferrer"><code>async</code> and <code>await</code></a> do is to make code easy to write and read - but is using them equal to spawning background threads to perform long duration logic?</p>
  
  <p>I'm currently trying out the most basic example. I've added some comments inline. Can you clarify it for me?</p>
  
  <pre><code>// I don't understand why this method must be marked as `async`.
  private async void button1_Click(object sender, EventArgs e)
  {
      Task&lt;int&gt; access = DoSomethingAsync();
      // task independent stuff here
  
      // this line is reached after the 5 seconds sleep from 
      // DoSomethingAsync() method. Shouldn't it be reached immediately? 
      int a = 1; 
  
      // from my understanding the waiting should be done here.
      int x = await access; 
  }
  
  async Task&lt;int&gt; DoSomethingAsync()
  {
      // is this executed on a background thread?
      System.Threading.Thread.Sleep(5000);
      return 1;
  }
  </code></pre>