using System.Threading.Tasks;
public static async Task Main()
for (int i = 1; i < 5; i++)
Console.WriteLine($"Looping through index {i} now...");
DoWorkAsync($"Task {i}", i);
Console.WriteLine("Console app ended");
public static async Task DoWorkAsync(string nameOfTask, int secondsToDelay)
Console.WriteLine($"{nameOfTask} has started.");
await Task.Delay(secondsToDelay * 1000);
Console.WriteLine($"{nameOfTask} has finished.");