Пример #1
0
        static void Main(string[] args)
        {
            var singleton = SingletonFactory.CreateInstance();

            singleton.Show();

            var sec = SingletonFactorySec.CreateInstance();

            sec.Show();
            Console.ReadKey();
        }
Пример #2
0
 public static SingletonFactorySec CreateInstance()
 {
     if (_singletonFactory == null)
     {
         lock (_lock)
         {
             if (_singletonFactory == null)
             {
                 _singletonFactory = new SingletonFactorySec();
             }
         }
     }
     return(_singletonFactory);
 }