Is this a valid, lazy, thread-safe Singleton implementation for C#?
- by Matthew
I implemented a Singleton pattern like this:
public sealed class MyClass {
...
public static MyClass Instance {
get { return SingletonHolder.instance; }
}
...
static class SingletonHolder {
public static MyClass instance = new MyClass ();
}
}
From Googling around for C# Singleton implementations, it…