Practice mode C#

Which method creates a task that completes when all of several tasks have completed?

Correct answer B. Task.WhenAll

Explanation

Task.WhenAll takes several tasks and returns one that completes when every one of them has finished, so await Task.WhenAll(t1, t2) runs work concurrently and waits for all. If tasks return values, it produces an array of results. Task.WhenAny completes when the first task finishes, Task.Delay waits for a time span and Task.Yield forces an asynchronous yield.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

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

Links and website addresses are not allowed in comments.