我想根据我是否在 Debug模式中构建来有条件地排除/包含代码。
我可以像在 C++ 中那样使用像 #ifndef _DEBUG
这样简单的东西吗?
最佳答案
#if DEBUG
Console.WriteLine("Debug version");
#endif
#if !DEBUG
Console.WriteLine("NOT Debug version");
#endif
参见 this .
关于c# - 在 C# 中有没有办法从 C/C++ 复制 '#ifndef _DEBUG'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2280321/