using System; namespace ZJ_BYD.Untils { public class Singleton where T : class, new() { private static T _instance; protected static readonly object SyncLock = new object(); public static T Instance { get { if (_instance == null) { lock (SyncLock) { if (_instance == null) { _instance = new T(); } } } return _instance; } } } }