I was thinking about the classic issue of lazy singleton initialization - the whole matter of the inefficiency of:
if (instance == null)
{
instance = new
I have just started to program in c# (coming from C++ its a breath of fresh air) and this is what I use to implement singleton patterns.
public sealed class MyClass
{
#region make singleton
static readonly Lazy<MyClass> _singleton =
new Lazy<MyClass>(() => new MyClass());
public static MyClass Singleton
{
get { return _singleton.Value; }
}
private MyClass() { Initialize() };
#endregion
Initialize() { /*TODO*/ };
}