终端一体化运控平台
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
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. }