title: Use Task.WaitAll() to handle awaited tasks?
body: <p>Ideally what I want to do is to delay a task with a non-blocking mode and then wait for all the tasks to complete. I've tried to add the task object returned by Task.Delay and then use Task.WaitAll but seems this won't help. How should I solve this problem?</p>
  
  <pre><code>class Program
  {
      public static async void Foo(int num)
      {
          Console.WriteLine("Thread {0} - Start {1}", Thread.CurrentThread.ManagedThreadId, num);
  
          var newTask = Task.Delay(1000);
          TaskList.Add(newTask);
          await newTask;
  
          Console.WriteLine("Thread {0} - End {1}", Thread.CurrentThread.ManagedThreadId, num);
      }
  
      public static List&lt;Task&gt; TaskList = new List&lt;Task&gt;();
  
      public static void Main(string[] args)
      {
          for (int i = 0; i &lt; 3; i++)
          {
              int idx = i;
              TaskList.Add(Task.Factory.StartNew(() =&gt; Foo(idx)));
          }
  
          Task.WaitAll(TaskList.ToArray());
      }
  }
  </code></pre>