泛型单例
 /// <summary>
    /// 创建单例对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public sealed class Singleton<T> where T : new()
    {
        /// <summary>
        /// 单例对象
        /// </summary>
        public static readonly T Instance;
        /// <summary>
        /// 静态构造
        /// </summary>
        static Singleton()
        {
            Instance = new T();
        }
    }
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号