http://www.cnblogs.com/kevinwan/archive/2007/01/17/CSharpSingleton.html
实现代码:
1 public class Singleton
2 {
3 private static class LazyHolder
4 {
5 public static readonly Singleton Instance = new Singleton();
6 }
7
8 private Singleton()
9 {
10 }
11
12 public static Singleton GetInstance()
13 {
14 return LazyHolder.Instance;
15 }
16 }
2 {
3 private static class LazyHolder
4 {
5 public static readonly Singleton Instance = new Singleton();
6 }
7
8 private Singleton()
9 {
10 }
11
12 public static Singleton GetInstance()
13 {
14 return LazyHolder.Instance;
15 }
16 }