class GenericSingleton<T> where T : class, new() { private static object lockObject = new object(); private static T m_Instance; public static T GetInstance() { if( m_Instance != null) return m_Instance; lock ( lockObject) { if (m_Instance == null) { m_Instance = new T(); } } return m_Instance; } }
Remember Me