static void TestSimple() { SingltonClass s1 = SingltonClass.GetInstance(); Console.WriteLine(s1.GetHashCode()); SingltonClass s2 = SingltonClass.GetInstance(); Console.WriteLine(s2.GetHashCode()); }
static void TestThresd() { (new Thread(() => { SingltonClass s1 = SingltonClass.GetInstance(); Console.WriteLine(s1.GetHashCode()); })).Start(); SingltonClass s2 = SingltonClass.GetInstance(); Console.WriteLine(s2.GetHashCode()); }