Csharp/C Sharp by API/System.Diagnostics/TextWriterTraceListener
Версия от 15:31, 26 мая 2010; (обсуждение)
new TextWriterTraceListener(String fileName)
#define DEBUG
using System;
using System.Globalization;
using System.Diagnostics;
class MainClass
{
public static void Main()
{
TextWriterTraceListener tl = new TextWriterTraceListener("Example21_12.txt");
Debug.Listeners.Add(tl);
EventLogTraceListener t2 = new EventLogTraceListener("Application");
Debug.Listeners.Add(t2);
Debug.WriteLine("Starting Main()");
Debug.Assert(1 == 2, "1 ==2");
Debug.WriteLine("Exiting Main()");
Debug.Flush();
Debug.Close();
}
}