Created
May 26, 2016 19:42
-
-
Save mantzas/07a1be5a05ea575dfe0bebba5e931dcd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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