How should you complete the relevant code?

DRAG DROP
You develop an application that displays information from log files when errors occur. The
application will prompt the user to create an error report that sends details about the error
and the session to the administrator.
When a user opens a log file by using the application, the application throws an exception
and closes.
The application must preserve the original stack trace information when an exception occurs
during this process.
You need to implement the method that reads the log files.
How should you complete the relevant code? (To answer, drag the appropriate code
segments to the correct locations in the answer area. Each code segment 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 develop an application that displays information from log files when errors occur. The
application will prompt the user to create an error report that sends details about the error
and the session to the administrator.
When a user opens a log file by using the application, the application throws an exception
and closes.
The application must preserve the original stack trace information when an exception occurs
during this process.
You need to implement the method that reads the log files.
How should you complete the relevant code? (To answer, drag the appropriate code
segments to the correct locations in the answer area. Each code segment 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 *


MarcoJacob

MarcoJacob

2 and 4

MarcoJacob

MarcoJacob

private async void GetData(WebResponse response)
{
var streamReader = new StreamReader(response.GetResponseStream());

= await streamReader.ReadLineAsync();
}

宾宾

宾宾

try catch 包含在using里面,这个异常根本就不会被捕捉到。

al adeeb

al adeeb

1. async
2. await
3. ReadLineAsync()

ReadToEndAsync() is not correct since only the first line of the response is required.

Nirosh

Nirosh

Why not StringReader?

Artem

Artem

StreamReader is correct, because:

public StringReader(string s)
where s – The string to which the StringReader should be initialized.
it is not file name

Correct answer is 2 and 4