终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 年之前
12345678910111213141516171819202122232425262728293031
  1. using System;
  2. /* ***********************************************
  3.  * subject 单例对象基类
  4.  * author 张原川
  5.  * date   2019/6/3 9:49:03
  6.  * ***********************************************/
  7. namespace BPASmartClient.Helper
  8. {
  9. /// <summary>
  10. /// 单例对象基类
  11. /// </summary>
  12. /// <typeparam name="T"></typeparam>
  13. public class Singleton<T> where T : new()
  14. {
  15. private static object _async = new object();
  16. private static T _instance;
  17. static readonly Lazy<T> instance = new();
  18. /// <summary>
  19. /// 获取实例
  20. /// </summary>
  21. /// <returns></returns>
  22. public static T GetInstance()
  23. {
  24. return instance.Value;
  25. }
  26. }
  27. }