Beispiel #1
0
        public static SingletoneExample Dat()
        {
            if (dat == null)
            {
                dat = new SingletoneExample();
            }

            return(dat);
        }
Beispiel #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();
        }