C# Algo   C++   C#   Demo   JS   Py   SQL   Stat   TA

Design Patterns

Singleton

public class Singleton {
    Singleton() {}

    public static Singleton Instance {
        get {
            return Nested.instance;
        }
    }

    class Nested {
        static Nested() {}
        internal static readonly Singleton instance = new Singleton();
    }
}
C# Algo   C++   C#   Demo   JS   Py   SQL   Stat   TA