Skip to content

Instantly share code, notes, and snippets.

@i3arnon
Created October 10, 2014 18:03
Show Gist options
  • Save i3arnon/8dfd5aaa55315502fb3e to your computer and use it in GitHub Desktop.
Save i3arnon/8dfd5aaa55315502fb3e to your computer and use it in GitHub Desktop.
async method - synchronous part
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