Tag: 预处理程序 指令

#if预处理程序指令,用于DEBUG以外的指令

我知道我可以通过这样做来使用预处理器指令来检查Debug / Release: #if DEBUG //debug mode #elif //release mode #endif 但是如何检查其他配置,比如Test。 在VB中你可以这样做: #If CONFIG = “Release” Then ‘Release mode #ElseIf CONFIG = “Test” Then ‘Test mode #ElseIf CONFIG = “Debug” Then ‘Debug mode #End If 所以,我的问题是在C#中,我该如何检查测试模式? 如果我在调试和测试中,我有一些代码要执行,但不是在发布模式下,所以具体来说,我需要一种方法来检查是否处于发布模式。 在VB中我会这样做: #If Not CONFIG = “Release” Then ‘Do something here for every configuration that is not Release […]