using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ScadaTool.Helper { /// /// 单例辅助类 /// public class SingletonMode where T : class { public static T _Instance; public static T Instance() { Type type = typeof(T); lock (type) { if (SingletonMode._Instance == null) { SingletonMode._Instance = (Activator.CreateInstance(typeof(T), true) as T); } return SingletonMode._Instance; } } } }