我们在编程debug的时候需要程序运行特定的代码或是打出运行情况,而在release发布时为了节省效率,不希望这些附加的代码运行 其实各种编程语言都提供了解决方案,如下面两个代码段: 一:debug和release运行不同的代码 #if DEBUG path = BenQ.HI0.EPS.ToolUtil.PathString.formatPathString(System.IO.Path.GetFullPath(System.Configuration.ConfigurationSettings.AppSettings.Get("AppPath"))); configPath = BenQ.HI0.EPS.ToolUtil.PathString.formatPathString(System.IO.Path.GetFullPath(System.Configuration.ConfigurationSettings.AppSettings.Get("ConfigPath"))); #else path = BenQ.HI0.EPS.ToolUtil.PathString.formatPathString(System.Configuration.ConfigurationSettings.AppSettings.Get("AppPath")); configPath = BenQ.HI0.EPS.ToolUtil.PathString.formatPathString(System.Configuration.ConfigurationSettings.AppSettings.Get("ConfigPath")); #endif二:只在debug时运行
#if DEBUG this.printDataTable(tbErpPo); #endif |
如何使程序在Debug状态或是Release状态下运行不同的代码
最新推荐文章于 2023-11-23 09:49:48 发布

2万+

被折叠的 条评论
为什么被折叠?



