How should you complete the relevant code?

DRAG DROP
You are developing an application that will include a method named GetDat
a. The GetData() method will retrieve several lines of data from a web service by using a
System.IO.StreamReader object.
You have the following requirements:
The GetData() method must return a string value that contains the entire response from the web
service.
The application must remain responsive while the GetData() method runs.
You need to implement the GetData() method.
How should you complete the relevant code? (To answer, drag the appropriate objects to the
correct locations in the answer area. Each object may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)

DRAG DROP
You are developing an application that will include a method named GetDat
a. The GetData() method will retrieve several lines of data from a web service by using a
System.IO.StreamReader object.
You have the following requirements:
The GetData() method must return a string value that contains the entire response from the web
service.
The application must remain responsive while the GetData() method runs.
You need to implement the GetData() method.
How should you complete the relevant code? (To answer, drag the appropriate objects to the
correct locations in the answer area. Each object may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)

Answer:



Leave a Reply 6

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


Hans Werner

Hans Werner

When trying to pass the exam, I was really confused about the empty space in front of “await”. Since “await await” is not a valid construct in C#, I left it empty during my exam and I fear that was a bad idea.

Anyone has an idea if this field should be kept blank or not to pass this question successfully?

P

P

hey Hans did you clear your exam with this question can you help me.

rao

rao

news about this question? maybe it’s a wrong past/copy but the fields needs to be completed with async, await, readtoend() anyway!

Osman Esen

Osman Esen

It not wrong.

The first await returns a Task and by adding the second await in front of it, the result will be string.

Danielasun

Danielasun

1-async
2-await
3-ReadLineAsync

Zag

Zag

Are you sure ?

“The GetData() method will retrieve several lines of data from a web service by using a
System.IO.StreamReader object.”

Do we need to use ReadToEndAsync() when reading several lines ?