System.Diagnostics Namespace
Provides classes that allow you to debug your application and trace the execution of the code. This namespace includes classes for performance counters, event logs, tracing, and process management.
Classes
Activity
Represents an activity within a distributed trace.
ActivityListener
Listens for Activity events from various sources.
ActivitySource
A factory for creating
Counter
Represents a counter that can be incremented.
Debug
Provides methods and properties that help you debug your application.
Methods:
Assert(Boolean)
public static void Assert(bool condition)
Indicates whether a specified condition is true. If false, the debugger breaks execution.
WriteLine(String)
public static void WriteLine(string message)
Writes a message to the output, followed by a line terminator.
DiagnosticsCategoryAttribute
Categorizes diagnostic events.
EventLog
Provides access to the Windows event log.
Process
Represents a process on the local computer or a remote computer.
ProcessStartInfo
Provides information needed to start a process.
Stopwatch
Measures elapsed time.
Methods:
Start()
public static Stopwatch StartNew()
Initializes a new instance of the Stopwatch class, sets the elapsed property to zero, and starts measuring elapsed time.
Stop()
public void Stop()
Stops measuring the elapsed time.
Trace
Provides methods and properties that help you trace the execution of your application.
Methods:
TraceInformation(String)
public static void TraceInformation(string message)
Writes an informational message to the trace listeners.
TraceError(String)
public static void TraceError(string message)
Writes an error message to the trace listeners.
TraceEventCache
Contains trace event information like the logical operation stack, process ID, and thread ID.
TraceFilter
Abstract base class for implementing trace filters.
TraceLevel
Specifies which trace messages to output.
TraceListener
Provides the base class for the System.Diagnostics.TraceListener collection, which receives and processes trace output.
Enums
TraceLevel
Specifies which trace messages to output.