Is '#IF DEBUG' deprecated in modern programming?
<p>This is my first StackOverflow question so be nice! :-)</p>

<p>I recently came across the following example in some C# source code:</p>

<pre><code>public IFoo GetFooInstance()
{
    #IF DEBUG
        return new TestFoo();
    #ELSE
        return new Foo();
    #ENDIF
}
</code></pre>

<p>Which lead me to these questions:</p>

<ol>
<li>Is the use of "#IF DEBUG" unofficially deprecated? If not what is considered to be a good implementation of its use?</li>
<li>Using a class factory and/or tools like MOQ, RhinoMocks, etc how could the above example be implemented?</li>
</ol>
