/// <summary> /// 单例模式 /// sealed修饰符,不能被继承人 /// 构造函数private 外面不可以实例化! /// </summary> public sealed class Singleton { private Singleton() { Console.WriteLine("初始化一次"); } private static Singleton Instance = new Singleton(); public static Singleton CreateInstance() { return Instance; } }