Important C# Topics

Async and Await

Write non-blocking asynchronous workflows.

Introduction

Task-based asynchronous code frees a thread while waiting for I/O or timers.

await pauses the method without blocking a thread and resumes it when the task completes.

Runnable C# example

C#
Run code →
Program.cs
using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        await Task.Delay(20);
        Console.WriteLine("Async work complete");
    }
}
Result of running the code
Async work complete

Practice 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.

Practice with a challenge

Use what this lesson covers to solve a real problem. Each challenge runs in your browser with instant tests and an AI review.

All challenges