I need to generate a report once a number of methods have completed. But in this sample they are not asynchronous.
static void Main(string[] args)
{
TaskMan();
}
async static void TaskMan()
{
Task t1 = m1();
Task t2 = m2();
await Task.WhenAll(t1, t2);
Console.WriteLine("Complete");
}
async static Task m1()
{
decimal result = 0;
for (int n = 1; n < 100000000; n++)
{
result += n;
}
Console.WriteLine(result);
}
async static Task m2()
{
decimal result = 0;
for (int n = 1; n < 100000000; n++)
{
result += n;
}
Console.WriteLine(result);
}
How to do them really async?