#if DEBUG运行时 [英] When #if DEBUG runs
本文介绍了#if DEBUG运行时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的C#类中有此代码。
I have this code in my C# class.
#if DEBUG
private const string BASE_URL = "http://www.a.com/";
#else
private const string BASE_URL = "http://www.b.com//";
#endif
我想问的是
#if DEBUG
代码中的路径被执行?
是否被执行
- 当我在Visual Studio中运行调试会话?
- 从调试文件夹中手动运行有问题的exe或dll吗?
- 在任何其他情况下,我忘记提了?
推荐答案
#if调试
这是一个预处理程序定义。
#if DEBUG
It's a preprocessor definition.
在定义DEBUG常量时进行编译。是的,它是调试生成配置的默认设置。
It compiles when you define DEBUG constant. And yes, it's default on Debug Build Configuration.
Visual Studio 2010项目属性:
如果定义调试常量
被选中VS将会编译:
If Define DEBUG constant
is checked VS will compile:
private const string BASE_URL = "http://www.a.com/";
否则(未选中)VS将编译:
Else (not checked) VS will compile:
private const string BASE_URL = "http://www.b.com//";
这篇关于#if DEBUG运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文