Csharp/C Sharp by API/System.Diagnostics/TextWriterTraceListener — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 18:31, 26 мая 2010

new TextWriterTraceListener(String fileName)

<source lang="csharp">

  1. 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();
 }

}


 </source>