标签:
1 public class SingleInstance 2 { 3 private static SingleInstance singleInstance = null; 4 private static readonly object locker = new object(); 5 private SingleInstance() 6 { 7 } 8 public static SingleInstance getInstance() 9 { 10 lock (locker) 11 { 12 if (singleInstance == null) 13 return new SingleInstance(); 14 } 15 return singleInstance; 16 } 17 }
标签:
原文地址:http://www.cnblogs.com/foreverApril/p/5050525.html