Exemplo n.º 1
0
 static SmartServiceCreator()
 {
     if (instance == null)
     {
         lock (dimmy)
         {
             if (instance == null)
             {
                 instance = new SmartServiceFactory();
             }
         }
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ISmartServiceFactory factory1 = SmartServiceCreator.Instance;
            ISmartServiceFactory factory2 = SmartServiceCreator.Instance;

            if (factory1 == factory2)
            {
                Console.WriteLine("Is one!");
            }
            else
            {
                Console.WriteLine("Ooops!");
            }
        }