I searched, but cannot find explicit confirmation anywhere ... If a task has several continuations (not chain continuations), are these continuations performed parallel to each other?
I want to run task1 and then task2-task3-task4 in parallel to each other and finally task5 when it is all over. An example is below. Will tasks 2, 3, and 4 definitely execute asynchronously with each other?
While we are in this matter, any suggestions for improving the template are welcome. There seem to be several different ways to achieve this composition. Thanks
public Task MyWorkflowAsync() { Task task1 = Task.Factory.StartNew( () => DoTask1() ); var tarray = new Task[] { task1.ContinueWith( task => DoTask2() ), task1.ContinueWith( task => DoTask3() ), task1.ContinueWith( task => DoTask4() ) }; return Task.Factory.ContinueWhenAll( tarray, completedTasks => DoTask5() ); }
source share