public class Singleton<T> where T : class, new() { public static T Value { get { return Instance.Value; } } private static class Instance { public static readonly T Value = new T(); } }
public class Singleton<T> where T : class, new() { public static T Value { get { return Instance.Value; } } private static class Instance { public static readonly T Value = new T(); } }
转载于:https://www.cnblogs.com/jRoger/articles/3423101.html