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