I am adding debug statements in a few places in my code. Each time I use a boolean to know if I should be debugging. This boolean is a property that checks a few unerlying conditions. To avoid unecessary boolean checks in the actual release build, I am also adding a compilation symbol.
#if MY_DEBUG
if (IsDebugging) {
...
}
#endif
Is there are way to somehow merge both if on one line without needing the #endif at the end? Something that would look somewhat like this:
#if MY_DEBUG if (IsDebugging) {
...
}
EDIT:
Thank you @canton7 I didn't know about the ConditionalAttribute
[Conditional("MY_DEBUG")]
I think this is what I was looking for