Windows 8 应用程序正在调试 [英] Windows 8 app is debug

查看:36
本文介绍了Windows 8 应用程序正在调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法检查 app.cs 是应用调试或部署的当前状态?

Is there a way to checkin app.cs is curent state of app debug or deployment?

或者问题是我只想在调试应用程序时执行一段代码.

Or the problem is that I want to exceute piece of code only when debuging application.

推荐答案

你可以像这样简单地使用 #if DEBUG 指令

You can simply use the #if DEBUG directive like so

#if DEBUG
    //code here only executes in debug
#endif

所以如果你想要一些在 DEBUG 中运行的代码和一些在 RELEASE 中运行的代码,你可以这样做:

So if you want some code that runs in DEBUG and some that is in RELEASE you do it like this:

#if DEBUG
    //code here only executes in debug
#else
    //code here only executes in release
#endif

正如 DAKL 已解释,您也可以使用 Conditional 属性.

And as DAKL has explained you could also use the Conditional attribute.

这篇关于Windows 8 应用程序正在调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆