没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
// Singleton
// Intent: "Ensure a class only has one instance, and provide a global
// point of access to it".
// For further information, read "Design Patterns", p127, Gamma et al.,
// Addison-Wesley, ISBN:0-201-63361-2
/* Notes:
* If it makes sense to have only a single instance of a class (a so-called
* singleton), then it makes sense to enforce this (to elimintate potential
* errors, etc).
*
* A class based on the singleton design pattern protects its constructor,
* so that only the class itself (e.g. in a static method) may instantiate itself.
* It exposes an Instance method which allows client code to retrieve the
* current instance, and if it does not exist to instantiate it.
*/
namespace Singleton_DesignPattern
{
using System;
class Singleton
{
private static Singleton _instance;
public static Singleton Instance()
{
if (_instance == null)
// Intent: "Ensure a class only has one instance, and provide a global
// point of access to it".
// For further information, read "Design Patterns", p127, Gamma et al.,
// Addison-Wesley, ISBN:0-201-63361-2
/* Notes:
* If it makes sense to have only a single instance of a class (a so-called
* singleton), then it makes sense to enforce this (to elimintate potential
* errors, etc).
*
* A class based on the singleton design pattern protects its constructor,
* so that only the class itself (e.g. in a static method) may instantiate itself.
* It exposes an Instance method which allows client code to retrieve the
* current instance, and if it does not exist to instantiate it.
*/
namespace Singleton_DesignPattern
{
using System;
class Singleton
{
private static Singleton _instance;
public static Singleton Instance()
{
if (_instance == null)
资源评论
- wwwxxxxxxwwwww2013-11-30还可以吧!可用。
xiaoyong21
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功