Прочитать на английском

Поделиться через


DefaultTraceListener.Write(String) Метод

Определение

Записывает вывод в функцию OutputDebugString и метод Log(Int32, String, String).

public override void Write (string? message);
public override void Write (string message);

Параметры

message
String

Сообщение, записываемое в объект OutputDebugString и метод Log(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);

Комментарии

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

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

Продукт Версии
.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
.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

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