示例#1
0
 public static Singleton2 GetInstance()
 {
     if (instance == null)
     {
         lock (myLock)
         {
             if (instance == null)
             {
                 instance = new Singleton2();
             }
         }
     }
     return(instance);
 }
 public static Singleton2 GetInstance()
 {
     if (instance == null)
     {
         lock (myLock)
         {
             if(instance==null)
                 instance=new Singleton2();
         }
     }
     return instance;
 }