console在文件中
1 System.IO.TextWriter old = System.Console.Out; //备份原来的stream
2 using (System.IO.TextWriter w = System.IO.File.CreateText("log.txt"))
3 {
4 System.Console.SetOut(w);
5 System.Console.WriteLine("123");
6 }
7
8 System.Console.SetOut(old);
9
10 System.Diagnostics.Process.Start("log.txt");
-------------------------------------------------
!!!作者:木由水 http://www.cnblogs.com/muyoushui