In C++ I have this: http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx .
So I can write code that will run only when I’m debugging, or only for specific platforms (PowerPC, MIPS, Power Macintosh etc. it’s not supported anymore but it’s a very good example).
You could also switch like that between 32bit and 64bit systems (of course that’s only useful when you’re releasing 2 different builds, each with its own processor architecture. in C# it’s a rare need but nevertheless, it is there).
So my question is if something like that exists in C#.
I realize there are no macros, but there are however symbols (even with the same #define keyword. so it kind of make sense — for me at least — that it should exist.
In .NET there are Pre-processing directives. To include some block of code only when debugging, you could do:
If you go to Project settings in Visual Studio, check the Build tab. There you can define Debug and Trace constants for selected configuration (checked by default for Debug build). You can also define additional conditional compilation symbols.