Redigera

Dela via


DefaultTraceListener.Write(String) Method

Definition

Writes the output to the OutputDebugString function and to the Log(Int32, String, String) method.

public:
 override void Write(System::String ^ message);
public override void Write (string? message);
public override void Write (string message);
override this.Write : string -> unit
Public Overrides Sub Write (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 Write(String) method to write the first 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

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

Applies to

See also