Skip to content

Instantly share code, notes, and snippets.

@joeriks
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save joeriks/9092236 to your computer and use it in GitHub Desktop.

Select an option

Save joeriks/9092236 to your computer and use it in GitHub Desktop.
C# async await the most basic example
async Task slowTask(){
await Task.Delay(1000);
Console.WriteLine("Prints after 1 second");
}
void Main()
{
slowTask();
Console.WriteLine("Prints immediately");
}
void slowTask(){
Console.WriteLine("Prints after");
}
void Main()
{
Task.Run(()=>slowTask());
Console.WriteLine("Prints immediately");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment