PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are developing an application that uses multiple asynchronous tasks to optimize performance.
You need to retrieve the result of an asynchronous task.
Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

5 Comments on “Which code segment should you use?

  1. paul_peters says:

    “B” is the wrong answer because of ‘string result = GetData()’ – GetData not returned string so this could not be compiled.

    “D” is the wrong answer ‘string result = async GetData()’ – ‘async’ could be used only in the method signature.

    “A” and “C” answers are both correct. That fact that ‘C’ has ‘public async Task GetData()’ – only describes how this method will works (async or not). – so correct answer on this: ‘A and C’.




    2



    1

Leave a Reply