title: What is the difference between Task.Run() and await Task.Run()?
body: <p>Following program is designed using general Task.Run() and using async and await (asynchronous). In both cases a different Thread is taken from Thread pool for new task. So, what is the difference? Asynchronous means it should use the main thread and free it until task completed. But it is also using another thread rather than using main thread.</p>
  
  <pre><code>public class Worker2
  {
      public bool IsComplete { get; private set; }
      internal void DoWork()
      {
          this.IsComplete = false;
          Console.WriteLine("Doing Work.");
          Task.Run(new Action(LongOperation));
          Console.WriteLine("Work Completed");
          IsComplete = true;
      }
  
      private void LongOperation()
      {
              Console.WriteLine("long operation thread thread :" + Thread.CurrentThread.ManagedThreadId);//Thread Id = 7. it is different from main thread id.
              Console.WriteLine("Working!");
              Thread.Sleep(3000);
      }
  }
  </code></pre>
  
  <p>//And asynchronous</p>
  
  <pre><code>public class Worker2
  {
      public bool IsComplete { get; private set; }
      internal async void DoWork()
      {
          this.IsComplete = false;
          Console.WriteLine("Doing Work.");       
          await LongOperation();
          Console.WriteLine("Work Completed");
          IsComplete = true;
      }
  
      private Task LongOperation()
      {
  
          return Task.Run(() =&gt;
              {
                  Console.WriteLine("long operation thread thread :" + Thread.CurrentThread.ManagedThreadId);
                  Console.WriteLine("Working!");
                  Thread.Sleep(3000);
              });
      }
  }
  </code></pre>