Private Constructor and Singleton design pattern
2007-11-07 10:47
225 查看
public class Singleton
{
static readonly Singleton instance = new Singleton();
static Singleton() //Private Constructor to make sure it cannot be instantiated out of the class bounds.
{
}
public static Singleton Instance
{
get { return instance}
}
}
{
static readonly Singleton instance = new Singleton();
static Singleton() //Private Constructor to make sure it cannot be instantiated out of the class bounds.
{
}
public static Singleton Instance
{
get { return instance}
}
}
相关文章推荐
- System.Lazy<T> and the Singleton Design Pattern
- Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a br
- Singleton Design Pattern and Thread Safety
- design pattern notes [2] - decorator, facade, Singleton, Flyweight, and Adapter
- design pattern notes [2] - decorator, facade, Singleton, Flyweight, and Adapter
- [C++]polymorphic and OOP design pattern Abstract Factory(抽象工厂模式)
- strategy design pattern and composite design pattern
- Head First Design Patterns 阅读笔记之七: Adapter and Facade Pattern
- Head First Design Pattern - 5 - This week's interview: Confessions of a Singleton
- Abstract Classes and Factory Design Pattern in Python
- Provider Model Design Pattern and Specification ,(MSDN)
- 第518篇--DesignPattern review (Singleton 2)
- 单态设计模式(Singleton Design Pattern)
- 设计模式之---单例模式(Singleton Design Pattern)
- 单态设计模式(Singleton Design Pattern)
- [转贴] Double-checked locking and the Singleton pattern
- Design pattern and Software design interview questions for Programmers
- Using the Singleton design pattern
- The Singleton of Design Pattern单态模式
- 单件模式 (Singleton design pattern)