O'Reilly logo

Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) by Priti Kalani, Amit Kalani, Kalani Kirk Hausman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Practice Test

Question 1You develop a customer contact-management application using Visual Studio .NET. You use the methods of the Trace and Debug classes to log serious error messages encountered during program execution. You want to record all such errors in the Windows event log. You do not want any duplicate entries for error messages in the event log. In what two ways can you add a listener to the Windows event log?
  • A.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    Trace.Listeners.Add(traceListener);
    
  • B.

    EventLogTraceListener traceListener =
        new EventLogTraceListener("CustomEventLog");
    Trace.Listeners.Add(traceListener);
    Debug.Listeners.Add(traceListener);
    
  • C.

     EventLogTraceListener traceListener = new EventLogTraceListener("CustomEventLog"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required