共用方式為


DefaultTraceListener.Write(String) 方法

定義

將輸出寫入 OutputDebugString 函示和 Log(Int32, String, String) 方法。

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)

參數

message
String

要寫入 OutputDebugStringLog(Int32, String, String) 的訊息。

範例

下列程式代碼範例會格式化函式的結果,並使用 Write(String) 方法將訊息 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)

備註

如需 Win32 OutputDebugString 偵錯函式的相關信息,請參閱 Platform SDK 或 MSDN 中的 “OutputDebugString”。

適用於

另請參閱