Possible Duplicate:
Singleton by Jon Skeet clarification
I am reading up on Singletons and and now (also thanks to SO) quite clued up.
My implementation (which should be text book) looks like
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
private Singleton(){ }
static Singleton(){ }
public static Singleton Instance { get { return instance; } }
}
My question is, on .NET 4.0, should I include the constructors (I think the private ctor is implicitly created - but what about the static (doubtful)).
The following seems to work just as well, but I'm concerned it only works well in my contrived test example.
public sealed class Singleton
{
private static readonly Singleton instance = new Singleton();
public static Singleton Instance { get { return instance; } }
}