using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataVAPI.Tool { /// /// 单例对象基类 /// /// public class Singleton where T : new() { private static object _async = new object(); private static T _instance; static readonly Lazy instance = new(); /// /// 获取实例 /// /// public static T GetInstance() { return instance.Value; //lock (_async) //{ // if (null == _instance) // { // _instance = Activator.CreateInstance(); // } // return _instance; //} } } }