public sealed class Singleton<T> where T:new()
...{
private static T instance = new T();
private static object lockHelper = new object();
private Singleton() ...{ }
public static T GetInstance()
...{
if (instance == null)
...{
lock (lockHelper)
...{
if (instance == null)
...{
instance = new T();
}
}
}
return instance;
}
}