【C#】高级语言特有的单例模式

public class Singleton
{

	private Singleton ()
	{
	}
       // 变量标记为 readonly。第一次引用类的成员或创建实例时,仅仅实例化一次instance对象  
	public static readonly Singleton instance = new Singleton ();
}

posted @ 2017-07-20 10:29  yfceshi  阅读(166)  评论(0编辑  收藏  举报