首页 > 代码库 > C#中的编译开关

C#中的编译开关

c#不支持宏定义,只支持编译开关。

======================================
我想加上#define xxx就编译a代码,否则编译b代码,像这样的:
#if xxx
a
#else
b
#endif

============================================

//#define Timing
#define Channel

上面两个,任意选一个,就说明开关打开了

#if Timing     [#define Timing]
phy.StartInfo.FileName = "DrawTiming.exe";
#elif Channel
phy.StartInfo.FileName = "DrawChannel.exe";
#else
phy.StartInfo.FileName = "DrawPhysical.exe";
#endif

C#中的编译开关