c# - Is '#IF DEBUG' deprecated in modern programming? -


This is my first stack overflow question, so be good! : -)

I recently came to some C # source code for the following example:

  public IFoo GetFooInstance () {#IIF return new TestFoo () ; #ELSE Returns New Foo (); # ENDIF}  

Tell me the reason for these questions:

  1. Is the use of "delete the id #" unauthorized dislike? If its use is not considered as a good implementation?
  2. Using a class factory and / or tools such as MOQ, RhinoMox, etc., how can the above example be implemented? Using the IoC container, the entire function becomes redundant, instead of calling GetFooInstance, you will have a similar code like this:
    text item itemprop =
    "Text" / P>
      ObjectFactory.GetInstance & lt; IFoo & gt; ();  

    Your IoC container can be setup in the setup code or through a configuration file.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -