public static SingletoneExample Dat() { if (dat == null) { dat = new SingletoneExample(); } return(dat); }
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(); }