task runners in c#
The code below shows the simple way of implementing a task runner in your C# code
static void Main(string[] args)
{
Test();
Console.WriteLine("Loading...");
Console.ReadLine();
}
static async Task Test()
{
var t1 = Task.Run(async () =>
{
await Task.Delay(1000);
Console.WriteLine("Task 1");
});
var t2 = Task.Run(() =>
{
Console.WriteLine("Task 2");
});
var t3 = Task.Run(() =>
{
Console.WriteLine("Task 3");
});
await Task.WhenAll(new Task[] { t1, t2, t3 });
}