DefaultTraceListener.WriteLine(String) Метод

Определение

Записывает вывод в функцию OutputDebugString и метод Log(Int32, String, String), затем происходит возврат каретки и перевод строки (\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)

Параметры

message
String

Сообщение, записываемое в объект OutputDebugString и метод Log(Int32, String, String).

Примеры

В следующем примере кода форматирует результаты функции и использует WriteLine(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)

Комментарии

Ограничитель строки по умолчанию — возврат каретки, за которым следует перевод строки (\r\n).

Сведения о функции отладки Win32 OutputDebugString см. в пакете SDK для платформы или на сайте MSDN.

Этот метод задает свойству NeedIndent значение true.

Применяется к

См. также раздел