Exemplo n.º 1
0
        public static SingletoneExample Dat()
        {
            if (dat == null)
            {
                dat = new SingletoneExample();
            }

            return(dat);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Thread thr = new Thread(() => {
                SingletoneExample s = SingletoneExample.Dat();
                s.CountOne();
            });

            thr.Start();

            Thread thr2 = new Thread(() => {
                SingletoneExample s = SingletoneExample.Dat();
                s.CountOne();
            });

            thr2.Start();
        }