Ejemplo n.º 1
0
        public static SingletonDemo GetInstance()
        {
            if (currentInstance == null)
            {
                currentInstance = new SingletonDemo();
            }

            return(currentInstance);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var singletonObject = SingletonDemo.GetInstance();

            singletonObject.DoSomethingWiththeSingleton();
        }