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?
A. Option A
B. Option B
C. Option C
D. Option D
5 Comments on “Which code segment should you use?”
Mariuszsays:
Correct answer is A
3
8
Arekssays:
Can you explain why please?
1
0
ivannathansays:
Sure. Task is already async, so no need to add one more “async/await”
Adding them to GetData is redundant.
0
0
XelMedsays:
answer C, due to the fact that there isn’t async in GetData method.
It leads to compilation Error
3
4
ivannathansays:
GetData has Task type, which doesn’t require “async” because it’s already asynchronous. .
Correct answer is A
3
8
Can you explain why please?
1
0
Sure. Task is already async, so no need to add one more “async/await”
Adding them to GetData is redundant.
0
0
answer C, due to the fact that there isn’t async in GetData method.
It leads to compilation Error
3
4
GetData has Task type, which doesn’t require “async” because it’s already asynchronous. .
1
0