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.
|
- using System;
-
- /* ***********************************************
- * subject 单例对象基类
- * author 张原川
- * date 2019/6/3 9:49:03
- * ***********************************************/
-
- namespace BPASmartClient.Helper
- {
- /// <summary>
- /// 单例对象基类
- /// </summary>
- /// <typeparam name="T"></typeparam>
- public class Singleton<T> where T : new()
- {
- private static object _async = new object();
-
- private static T _instance;
-
- static readonly Lazy<T> instance = new();
- /// <summary>
- /// 获取实例
- /// </summary>
- /// <returns></returns>
- public static T GetInstance()
- {
- return instance.Value;
- }
- }
- }
|