I prefer the
[Conditional("DEBUG")]
attribute over
#if DEBUG
.
This is especially advised for your logging example.
E.g.
[System.Diagnostics.Conditional("DEBUG")]
private void Validate() { }
or
[System.Diagnostics.Conditional("DEBUG")]
public static void DebugLog(string message) { ... }
You call these methods like any other method. The compiler will
not add any call code if "DEBUG" is not defined.
BTW: Your resoning of "not Debug" equals "Release" is not true in general, you might have other configurations than only the default "Debug" and "Release" configurations.
I feel comfortable on a variety of systems (UNIX, Windows, cross-compiled embedded systems, etc.) in a variety of languages, environments, and tools.
I have a particular affinity to computer language analysis, testing, as well as quality management.
More information about what I do for a living can be found at
my LinkedIn Profile and on my company's
web page (German only).