Practice mode C#

What does the await operator do in a C# async method?

Correct answer C. It suspends the method until the awaited task completes, without blocking the thread

Explanation

When await meets an incomplete task, the async method returns control to its caller and the thread is free for other work. When the task completes, the rest of the method resumes as a continuation. Blocking calls such as .Result or .Wait() hold the thread instead and can cause deadlocks. await does not by itself create a new thread.

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.