Created
October 10, 2014 18:03
-
-
Save i3arnon/8dfd5aaa55315502fb3e to your computer and use it in GitHub Desktop.
async method - synchronous part
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
private static void Main() | |
{ | |
Console.WriteLine("before start"); | |
var task = InfiniteAsync(); | |
Console.WriteLine("after start"); | |
Task.WhenAll(task).Wait(); | |
Console.WriteLine("after whenAll"); | |
} | |
private static async Task InfiniteAsync() | |
{ | |
while (true) ; | |
await Task.Delay(1); | |
} | |
The output: | |
> before start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment