Define trace class - DOT.NET

Define trace class.

- The trace class in the code is used to diagnose the problem.

- You can use trace messages to your project to monitor events in the released version of the application.

- The trace class is found in the System.Diagnostics namespace.

- It provides a set of methods and properties that help you to trace the execution of your code.

- This class cannot be inherited.

Example:
public sealed class Trace

Following are the properties of trace class:

PropertiesDescription
AutoFlushGets or sets whether Flush should be called on the Listeners after every write.
CorrelationManagerGets the correlation manager for the thread for this trace.
IndentLevelGets or sets the indent level.
IndentSizeGets or sets the number of spaces in an indent.
ListenersGets the collection of listeners that is monitoring the trace output.
UseGlobalLockGets or sets a value indicating whether the global lock should be used.

- You can use the properties and methods in the Trace class to instrument release builds.

- Tracing helps to isolate problems and fix them without disturbing a running system.

- It provides a method to display an Assert dialog box.

- It is used for testing and optimization even after an application is compiled and released.

- It uses the time of application deployment and runs in different thread form main program execute thread.
Define Listeners collection of Trace and Debug objects - DOT.NET
The Trace and Debug objects contain a Listeners collection. These Listeners collection collect output from the trace statements....
Define Trace Switches - DOT.NET
Trace switches can be configured through application's .config file even after the application is compiled.....
Explain how to implement properties - DOT.NET
You can either use fields or property procedure to add properties....
Post your comment