C#面试问题41-60
41. What is the Singleton design pattern?
Singleton is a class that only allows creating a single instance of itselt.
单例设计模式是一个类,它只允许创建自己的单个实例。
构造函数防止他在单例类以外的地方被调用。
使用情景:need a single object resposible for some job that is shared by the whole application.
What is a globl state? public
Why is singleton considered an anti pattern?
What is the difference between the singleton design pattern and the application singleton?应用程序单例模式:不同位置使用的单个对象,不强制执行其单例。