Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SingletonTest st  = SingletonTest.Instanciraj();
            SingletonTest st2 = SingletonTest.Instanciraj();
            NestoTamo     ne  = new NestoTamo();

            if (st == ne.st)
            {
                Console.WriteLine("Isto :) ");
            }
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static SingletonTest Instanciraj()
        {
            if (_singl != null)
            {
                lock (_bzvz)
                {
                    if (_singl != null)
                    {
                        _singl = new SingletonTest();
                    }
                }
            }

            return(_singl);
        }
Exemplo n.º 3
0
 public NestoTamo()
 {
     st = SingletonTest.Instanciraj();
 }