Defines.Debug vs #if DEBUG
<p>I've started to use a define class like so:</p>

<pre><code>internal sealed class Defines
{
    /// &lt;summary&gt;
    /// This constant is set to true iff the define DEBUG is set.
    /// &lt;/summary&gt;
    public const bool Debug =
  #if DEBUG
   true;
  #else
   false;
  #endif
}
</code></pre>

<p>The advantages I see is:</p>

<ol>
<li>Ensures I don't break stuff that with an #if..#else..#endif would not be checked by compiler.</li>
<li>I can do a find references to see where it is used.</li>
<li>It's often useful to have a bool for debug, defines code is longer/more messy.</li>
</ol>

<p>Possible disadvantage I see:</p>

<p>Compiler can't optimize unused code if the Defines class is in another assembly. Which is why I have made internal.</p>

<p>Am I missing any other disadvantages?</p>

<p>[Edit] Typical examples of usage:</p>

<pre><code>private readonly Permissions _permissions = Defines.Debug ? Permissions.NewAllTrue()
                                                          : Permissions.NewAllFalse();
</code></pre>

<p>Or:</p>

<pre><code>var str = string.Format(Defines.Debug ? "{0} {1} ({2})" : "{0} {1}", actual, text, advance);
</code></pre>
