1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public class Singleton<T> where T : class, new() { #region ThreadSafe Singleton private static readonly Lazy<T> lazy = new Lazy<T>(() => new T()); public static T Instance { get { return lazy.Value; } } protected Singleton() { } #endregion } |