Пример #1
0
        public static SingleTon CreateInstance()
        {
            object lockingObject = new object();

            if (singleTonObject == null)
            {
                lock (lockingObject)
                {
                    if (singleTonObject == null)
                    {
                        singleTonObject = new SingleTon();
                    }
                }
            }
            return(singleTonObject);
        }
Пример #2
0
        static void Main(string[] args)
        {
            SingleTon objsing = SingleTon.CreateInstance();

            objsing.Display();
        }