Different types in release and debug in C#
<p>I've got some performance / memory critical code that uses floats. In debug mode I'd like to use decimals, as it makes it easier to verify calculations are correct.</p>

<p>Obviously I could do:</p>

<pre><code>#if DEBUG
        decimal x;
#else
        float x;
#endif
</code></pre>

<p>It would however involve doing this in numerous places, and it seems a bit cumbersome. I was wondering if there was a better way? I can't just create my own type that descends from one or the other depending on the build settings, as they're sealed classes. I also don't want to be casting left right and centre, as I said before, it's performance critical.</p>

<p>I basically want to be able to say.</p>

<pre><code>#if DEBUG
        MyType = decimal;
#else
        MyType = float;
#endif

MyType x;
</code></pre>

<p>Any suggestions would be appreciated.</p>
