System.Diagnostics.Trace.WriteLineIf Method

Writes a message to the trace listeners in the Trace.Listeners collection if a condition is true.

Syntax

[System.Diagnostics.Conditional("TRACE")]
public static void WriteLineIf (bool condition, string message)

Parameters

condition
true to cause a message to be written; otherwise, false.
message
A message to write.

Remarks

By default, the output is written to an instance of System.Diagnostics.DefaultTraceListener.

This method calls the TraceListener.WriteLine(string) method of the trace listener.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0