PrepAway - Latest Free Exam Questions & Answers

Which code should you insert at line 28?

You have the following code (line numbers are included for reference only):

You need to ensure that if an exception occurs, the exception will be logged.
Which code should you insert at line 28?

PrepAway - Latest Free Exam Questions & Answers

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:
* XmlWriterTraceListener
Directs tracing or debugging output as XML-encoded data to a TextWriter or to a Stream, such as a
FileStream.

3 Comments on “Which code should you insert at line 28?

  1. didii says:

    A will log it to the file Error.log in XML format.
    B does not use the exception so will not log anything valuable.
    C will write a message to the output window
    D will broadcast a message but there are no listeners to actually write the log

    So both A and C pass the requirements. A is not recommended to use (listener without source) and B is also not recommended to use (TraceSource is replacement of Trace).




    8



    0
    1. ivannathan says:

      Agree. Just a note:

      C will write a message, but the second parameter of Trace.WriteLine is category, not output file. (however it’s possible to configure Trace to save everything into file)




      1



      0

Leave a Reply