大家随便帮一下忙, C# 中如何写debug代码,如C++中 #define DEBUG#if (DEBUG)#endif这样不行吗? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先添加引用:using System.Diagnostics;下面的代码你可以在项目属性里修改条件编译常数设置为TRACE后,和TRACE;DEBUG两种情况看看public static int Main(string[] args) { Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; Debug.Indent(); Debug.WriteLine("Entering Main"); Console.WriteLine("Hello World."); Debug.WriteLine("Exiting Main"); Debug.Unindent(); return 0; } 如你所写#if DEBUG#endif 调试时,本身就定义了debug,所有,自接用#if DEBUG就可以了 关于三种写法的比较 【求助】如何将 application/octet-stream 转成可见内容 关于流的问题 为沈默1会变成01? 在研究PetShop 4.0設計思想中工廠類產生接口的疑問 瀑布模型、渐增模型/演化/迭代、原型模型、螺旋模型 怎么设置水晶报表(堆栈型)柱状图每一个柱边框的颜色或宽度? 大家帮我看看这里怎么错了,在线等!!!!下午1点结贴 如何触发listview滚动条滚动事件!!! 怎样换行 请教学习c#的入门书籍,本人有一定的c++的基础 要做自己的customers集合类,相关的几个似懂非懂的送分弱问题???
using System.Diagnostics;下面的代码
你可以在项目属性里修改条件编译常数设置为TRACE后,和TRACE;DEBUG两种情况看看
public static int Main(string[] args)
{
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
Debug.AutoFlush = true;
Debug.Indent();
Debug.WriteLine("Entering Main");
Console.WriteLine("Hello World.");
Debug.WriteLine("Exiting Main");
Debug.Unindent();
return 0;
}
#if DEBUG
#endif
#if DEBUG就可以了