title: How to wait nested task?
body: <p>Suppose  I have the following situation:</p>
  
  <pre><code>public void Foo()
  {
      Task.Run(() =&gt; DoWork())
        .ContinueWith((prev) =&gt; 
        {
            Console.WriteLine("Hello World!");
        }
  }
  
  public void DoWork()
  {
      Task.Run(() =&gt; HeavyOperation());
      Task.Run(() =&gt; HeavyOperation2());
      Task.Run(() =&gt; HeavyOperation3());
  }
  </code></pre>
  
  <p>I need to wait all the tasks within <code>DoWork</code> have finished before showing <code>Hello World</code>, actually my code will display <code>Hello World</code> but the task inside the method are still running</p>