In C #, we can differentiate code execution depending on the type of assembly. By default, we defined the types Debug and Release.
We can do this using the #if directive:
#if DEBUG public void Foo() { ... } #endif
But we can also use the Conditional attribute:
[Conditional("DEBUG")] public void Foo() { ... }
The second solution is claimed to be more serviceable (see: Effective C # by Bill Wagner).
My question is: how can I use the Conditional attribute with many build configurations? Is there any way to use the or operator? I ask, because I want some Foo method to be executed as, for example, in the DEBUG and BAR assembly configurations. What then?
c #
Landeeyo Dec 02 '15 at 8:43 2015-12-02 08:43
source share