Redigera

Dela via


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).

public:
 override void WriteLine(System::String ^ message);
public override void WriteLine (string? message);
public override void WriteLine (string message);
override this.WriteLine : string -> unit
Public Overrides Sub WriteLine (message As String)

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.

// 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);
' Compute the next binomial coefficient.  
' If an exception is thrown, quit.
Dim result As Decimal = CalcBinomial(possibilities, iter)
If result = 0 Then Return

' Format the trace and console output.
Dim binomial As String = 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

See also