I have many Tasks, that are running asynchronously
Task<bool> task1 = Task.Run<bool>(() =>
{
return this.addGroupStringToDictionary("IfcPolyline");
});
Task<bool> task2 = Task.Run<bool>(() =>
{
return this.addGroupStringToDictionary("IfcPolyLoop");
});
Task<bool> task3 = Task.Run<bool>(() =>
{
return this.addGroupStringToDictionary("IfcAxis2Placement2D");
});
Task<bool> task4 = Task.Run<bool>(() =>
{
return this.addGroupStringToDictionary("IfcAxis2Placement3D");
});
Now, I would like to execute other tasks, as soon as some of them finish.
Let's say I have 3 tasks that need to be executed after that :
task5 needs to be executed when Task1 and Task2 finished.
task6 needs to be executed when Task3 and Task4 finished.
task7 needs to be executed when Task1 and Task6 finished.
How can I do that, cause if I use await Task.WhenAll(task1,task2)
before calling task5, I also block execution of task6 and task7 ?