Sealed class Singleton {
public static readonly Singleton = new Singleton();
}
1. The Framework guarantees thread safety on static type initialization.
2. The Singleton is still created using lazy initialization in order not to consume memory when the object is not needed.
No comments:
Post a Comment