Quantcast
Channel: How do I set a conditional compile variable? - Stack Overflow
Viewing all articles
Browse latest Browse all 4

How do I set a conditional compile variable?

$
0
0

In C/C++ you can define macros in code like this:

#define OLD_WAY  1

Although I've never done it, I assume that the same thing is available in C#. More to the point, in C/C++ it is possible to then do some conditional compilation logic by doing something like this:

#if OLD_WAY == 1 int i = 0;#else int i = 1;#endif

OK, so this is all cool and all that. And again, I assume that such logic is possible within C#. What I'd like to know is, how do I define constants at the project level, so that I can put in logic that will allow me to conditional compile one block of code if I define the constant one way, or another block of code if I don't define it that way? I'm assuming that it's done somewhere in the project's properties, but how and where do I define it?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles



Latest Images