I\'ve been looking at the article on creating static constructors in c# here:
http://csharpindepth.com/Articles/General/Singleton.aspx
Now, one option he doesn\'
The question of the day is this: do you want lazy instantiation or not? If you do not need lazy instantiation and are perfectly fine with on-load instantiation, feel free to use the paradigm you have, or even use this somewhat less verbose version:
public static class ServiceFactory
{
private static readonly container = new Foo();
public static Instance { get { return container; } }
}
Both work fine and are perfectly valid -- as long as you don't need lazy. If you need lazy, use the Fifth version pointed out in the article.