using System; using System.Collections.Generic; using System.Text; namespace HBLConsole.Service { /// /// 单例对象基类 /// /// public class Singleton where T : new() { private static object _async = new object(); private static T _instance; static readonly Lazy instance = new Lazy(); /// /// 获取实例 /// /// public static T GetInstance() { return instance.Value; } } }