DefaultTraceListener.WriteLine(String) Method

Definition

Writes the output to the OutputDebugString function and to the Log(Int32, String, String) method, followed by a carriage return and line feed (\r\n).

C#
public override void WriteLine(string? message);
C#
public override void WriteLine(string message);

Parameters

message
String

The message to write to OutputDebugString and Log(Int32, String, String).

Examples

The following code example formats the results of a function and uses the WriteLine(String) method to write the last part of the message to a DefaultTraceListener.

C#
// Compute the next binomial coefficient.
// If an exception is thrown, quit.
decimal result = CalcBinomial(possibilities, iter);
if (result==0) {return;}

// Format the trace and console output.
string binomial = String.Format("Binomial( {0}, {1} ) = ", possibilities, iter);
defaultListener.Write(binomial);
defaultListener.WriteLine(result.ToString());
Console.WriteLine("{0} {1}", binomial, result);

Remarks

The default line terminator is a carriage return followed by a line feed (\r\n).

For information about the Win32 OutputDebugString debugging function, see the Platform SDK or MSDN.

This method sets the NeedIndent property to true.

Applies to

Produkt Versioner
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also