How to use async/await in c#?

Async/await provides an intuitive way to handle asynchronous operations.

Example:


  public async Task FetchDataAsync()
  {
      await Task.Delay(1000);  // Simulate async operation
      return "Data fetched";
  }

  string data = await FetchDataAsync();
  Console.WriteLine(data);
  

Beginner's Guide to C#