Beispiel #1
0
 public static SingletonNormalWay GetInstance()
 {
     if (instance == null)
     {
         lock (sysnhObj)
         {
             instance = new SingletonNormalWay();
             return(instance);
         }
     }
     else
     {
         return(instance);
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            SingletonNormalWay obj = SingletonNormalWay.GetInstance();

            obj.ReturnMessage();



            StaticClass obj1 = StaticClass.ReturnIsntance();

            obj1.ReturnMessage();


            Experiment exp = new Experiment();

            exp.SayHello();

            Console.Read();
        }