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.
The application will be deployed in a distributed environment.
You need to retrieve the result of an asynchronous task that retrieves data from a web service.
The data will later be parsed by a separate 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

2 Comments on “Which code segment should you use?

    1. ivannathan says:

      A.

      Task is already asyncronous, so no need to add one more async/await.

      You can get result from Task in few ways – waiting for it (.Wait() ot await) OR get Task.Result value.

      the answer B works, bu it requires redundant async/await in GetData()




      0



      0

Leave a Reply