namespace ProcessHacker { /// /// Implements the singleton pattern. /// public class Singleton where T : class, new() { private object _instanceLock = new object(); private T _instance = null; /// /// The single instance of the type. /// public T Instance { get { lock (_instanceLock) { if (_instance == null) _instance = new T(); return _instance; } } } } }