예제 #1
0
        static void TestSimple()
        {
            SingltonClass s1 = SingltonClass.GetInstance();

            Console.WriteLine(s1.GetHashCode());

            SingltonClass s2 = SingltonClass.GetInstance();

            Console.WriteLine(s2.GetHashCode());
        }
예제 #2
0
        static void TestThresd()
        {
            (new Thread(() =>
            {
                SingltonClass s1 = SingltonClass.GetInstance();
                Console.WriteLine(s1.GetHashCode());
            })).Start();
            SingltonClass s2 = SingltonClass.GetInstance();

            Console.WriteLine(s2.GetHashCode());
        }