Last active
September 28, 2017 03:56
-
-
Save jwChung/720cd295c350aff8873329c80465c479 to your computer and use it in GitHub Desktop.
This file contains 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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var stopwatch = new Stopwatch(); | |
stopwatch.Start(); | |
RunParallelly().Wait(); | |
stopwatch.Stop(); | |
Console.WriteLine(stopwatch.Elapsed); // 1초 | |
Console.ReadLine(); | |
} | |
private static async Task RunParallelly() | |
{ | |
var startedTask = Foo(); | |
await Bar(); | |
await startedTask; | |
} | |
private static async Task<int> Foo() | |
{ | |
await Task.Delay(1000); | |
return 10; | |
} | |
private static async Task<string> Bar() | |
{ | |
await Task.Delay(1000); | |
return "bar"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment