Singleton and Ingo's RemotingHelper
I have been using Ingo Rammer's RemotingHelper class for a while now. I'm not a big fan of a lot of statics in my apps so I rewrote it to a Singleton class based on microsofts suggestion for C#. The problem with this was that the constructor for the RemotingHelper class were run before RemotingConfiguration.Configure()which naturally caused problems.
As a consequence I rewrote the Singleton to do lazy initialization like this:
public
sealed class ServiceLocator{
private static ServiceLocator instance;
public static ServiceLocator Instance
{
get
{
if(instance == null)
instance = new ServiceLocator();
return instance;
}
}
private ServiceLocator() {}
}
Are there any reason that this will cause any problems? This could maybe be an alternative strategy in the C# pattern?