Back to course

Asynchronous Programming: Async and Await

.NET Zero to Hero: Master C# and Modern App Development

Asynchrony

Asynchronous programming allows your program to perform tasks (like downloading a file) without blocking the main thread.

Keywords:

  • async: Marks a method as asynchronous.
  • await: Pauses execution until the task completes.
  • Task: Represents the work to be done.

csharp public async Task DownloadDataAsync() { var result = await client.GetStringAsync("url"); return result; }