예제 #1
0
파일: Program.cs 프로젝트: pJqEM5Kj/stuff
        public static Singleton getInstance()
        {
            if (instance == null)
            {
                instance = new Singleton();
            }

            return instance;
        }
예제 #2
0
 //全局访问instance方法
 public static Singleton GetInstance()
 {
     return instance ?? (instance = new Singleton());//多线程下可能new多次
 }