예제 #1
0
        public new static DerivedSingleton Instance()
        {
            if (uniqueInstance == null)
            {
                uniqueInstance = new DerivedSingleton();
            }

            return(uniqueInstance as DerivedSingleton);
        }
예제 #2
0
        static void Main()
        {
            DerivedSingleton instance1 = DerivedSingleton.Instance();
            DerivedSingleton instance2 = DerivedSingleton.Instance();

            Console.WriteLine(ReferenceEquals(instance1, instance2));

            // Delay.
            Console.ReadKey();
        }