抽象单类模式
public abstract class Singleton<T> where T : new()
{
private static T instance;
private static readonly object loca = new object();
public static T Instance
{
get
{
if (instance == null)
{
lock (loca)
{
if (instance == null)
{
instance = new T();
}
}
}
return instance;
}
}
}