The main advantage of the first model over the second is what is called "lazy initialization." In the second example, as soon as SetLocator is called, you should have an IServiceLocator instance loaded into memory and ready to go. If such instances are expensive to create and / or create together with a number of other objects at the same time (for example, when starting the application), it is recommended to try to postpone the actual creation of the object in order to reduce noticeable delays for the user. In addition, if the dependency cannot be used by the dependent class (say that it is necessary only for certain operations, and the class can do other things that do not require the dependency), it would be useless to create an instance.
The solution is to provide a "factory method" instead of the actual instance. When an instance is really needed, the factory method is called, and the instance is created at the last possible moment before it is used. This reduces foreground loading time and avoids unnecessary dependencies.
source share