namespace ProductionSystem_Service
{
///
/// 单例模式
///
///
public class Singleton where T : class, new()
{
private static T _instance;
protected static readonly object SyncLock = new object();
public static T Instance
{
get
{
if (_instance == null)
{
lock (SyncLock)
{
if (_instance == null)
{
_instance = new T();
}
}
}
return _instance;
}
}
}
}