महत्वपूर्ण C# विषय

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

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");
    }
}
Expected output
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.