Async and Await
Task-based asynchronous code frees a thread while waiting for I/O or timers.
How it works
Write non-blocking asynchronous workflows.
await pauses the method without blocking a thread and resumes it when the task completes.
Runnable C# example
Program.cs
using System;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
await Task.Delay(20);
Console.WriteLine("Async work complete");
}
}
Async work completePractice with the debugger
Set a breakpoint on an important assignment or condition, click Debug, and inspect the local values before stepping to the next line.