Diagnostics.Debug/Trace调用WriteLine()什么也不输出啊解决方案
Diagnostics.Debug/Trace调用WriteLine()什么也不输出啊
我有下面的程序:
VC2012建立Debug版运行输出
Press any key to continue . . .
等于什么也没有。如果我保留Console.WriteLine那行,就会有输出
1
2
3
问题是: 难道Debug/Trace都根本不能工作吗? 还是我的用法有问题
------解决方案--------------------
打开trace 窗口
------解决方案--------------------
ctrl+alt+I 调处即时窗口就可以看到输出了
------解决方案--------------------
是不是要这样写呀
#if DEBUG
System.Diagnostics.Debug.WriteLine(ib);
System.Diagnostics.Trace.WriteLineIf(true, "kkk");
endif
我有下面的程序:
static void Main(string[] args)
{
int[] a = { 1, 2, 3 };
int[] b = new int[a.Length];
a.CopyTo(b, 0);
foreach (int ib in b)
{
//Console.WriteLine(ib);//输出1 2 3一共3行
System.Diagnostics.Debug.WriteLine(ib);
System.Diagnostics.Trace.WriteLineIf(true, "kkk");
}
}
VC2012建立Debug版运行输出
Press any key to continue . . .
等于什么也没有。如果我保留Console.WriteLine那行,就会有输出
1
2
3
问题是: 难道Debug/Trace都根本不能工作吗? 还是我的用法有问题
------解决方案--------------------
打开trace 窗口
------解决方案--------------------
ctrl+alt+I 调处即时窗口就可以看到输出了
------解决方案--------------------
是不是要这样写呀
#if DEBUG
System.Diagnostics.Debug.WriteLine(ib);
System.Diagnostics.Trace.WriteLineIf(true, "kkk");
endif