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:
- Is the use of "delete the id #" unauthorized dislike? If its use is not considered as a good implementation?
- 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"Text" / P>
- itemprop =
ObjectFactory.GetInstance & lt; IFoo & gt; ();Your IoC container can be setup in the setup code or through a configuration file.
Comments
Post a Comment