I read about the Conditional attribute today. According to MSDN:
Applying
ConditionalAttributeto a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated withConditionalAttributeis defined.
OK. That's clear. So the call to the method will not be compiled. But what about side effects?
[Conditional("UndefinedCondition")]
static void f1(int x) { Console.WriteLine(x); }
static int a = 0;
static void f2() { f1(++a); }
So when f2 is called, the call to f1 should be removed. But why is ++a removed as well? This does't make any sense to me!