Skip to content

Instantly share code, notes, and snippets.

@mantzas
Created May 26, 2016 19:42
Show Gist options
  • Save mantzas/07a1be5a05ea575dfe0bebba5e931dcd to your computer and use it in GitHub Desktop.
Save mantzas/07a1be5a05ea575dfe0bebba5e931dcd to your computer and use it in GitHub Desktop.
public async Task AwaitMultiple()
{
var t1 = Task.Run(() => Console.WriteLine());
var t2 = Task.Run(() => Console.WriteLine());
var t3 = Task.Run(() => Console.WriteLine());
var t4 = Task.Run(() => Console.WriteLine());
await t1;
await t2;
await t3;
await t4;
//vs
await Task.WhenAll(t1, t2, t3, t4);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment