DefaultTraceListener.Write(String) Method

Definition

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

C#
public override void Write(string? message);
C#
public override void Write(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 Write(String) method to write the first 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

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

Applies to

Product Versions
.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