This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using System;
namespace S3Demo.Helper
{
/// <summary>
/// 单例模式
/// </summary>
/// <typeparam name="T">//new(),new不支持非公共的无参构造函数 </typeparam>
// Token: 0x0200016F RID: 367
public abstract class SingletonHelper<T> where T : class
private static T sInstance;
/// 创建获取实例
/// <returns></returns>
public static T Instance()
Type typeFromHandle = typeof(T);
lock (typeFromHandle)
if (SingletonHelper<T>.sInstance == null)
SingletonHelper<T>.sInstance = (Activator.CreateInstance(typeof(T), true) as T);
}
return SingletonHelper<T>.sInstance;