using System; public class Singleton where T : class, new() { private static T _instance; public static T Instance { get { if (_instance == null) _instance = Activator.CreateInstance(); return _instance; } } }