Which code segment should you insert at line 09?

You are developing an application that will use multiple asynchronous tasks to optimize
performance.
You create three tasks by using the following code segment. (Line numbers are included for
reference only.)

You need to ensure that the ProcessTasks() method waits until all three tasks complete before
continuing.
Which code segment should you insert at line 09?

You are developing an application that will use multiple asynchronous tasks to optimize
performance.
You create three tasks by using the following code segment. (Line numbers are included for
reference only.)

You need to ensure that the ProcessTasks() method waits until all three tasks complete before
continuing.
Which code segment should you insert at line 09?

A.
Task.WaitFor(3);

B.
tasks.Yield();

C.
tasks.WaitForCompletion();

D.
Task.WaitAll(tasks);



Leave a Reply 2

Your email address will not be published. Required fields are marked *

18 − 1 =


Lord Vader

Lord Vader

Task.WaitAll Method (Task[])

Waits for all of the provided Task objects to complete execution.
Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)

Syntax

public static void WaitAll(
params Task[] tasks
)