Understanding Trace Listeners
In the preceding examples related to the
Debug class (and consequently related to the
Trace class, too), you saw how to send the output of the debugger to the Output window. The .NET Framework enables sending the output to other targets, known as trace listeners. A trace listener is an object that “listens” to what is happening at debugging time and then collects information under various forms. For example, you could collect information as XML files or just send such information to the Output window. Both the
Trace classes expose a property named
Listeners that represents a set of built-in listeners. Table 5.3 groups the .NET Framework built-in listeners.