using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DesignPattern
{
//单例模式
internal class SingletonPattern
{
}
class Singleton
{
private static Singleton instance = null;//静态私有成员变量
private Singleton()
{
}
public static Singleton GetInstance()//可以增加初始化等配置工作内容
{
if (instance == null)
{
instance = new Singleton();
}
return instance;
}
}
}