Questions tagged «compiler-directives»

14
C#if / then调试和发布指令
在“解决方案”属性中,对于我的唯一一个项目,我将“配置”设置为“发布”。 在主例程的开头,我有以下代码,并且显示“ Mode = Debug”。我在最上方也有这两行: #define DEBUG #define RELEASE 我在测试正确的变量吗? #if (DEBUG) Console.WriteLine("Mode=Debug"); #elif (RELEASE) Console.WriteLine("Mode=Release"); #endif 我的目标是根据调试与发布模式为变量设置不同的默认值。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.