using System; public abstract class DataSingleton where T : class, new() { private static T m_instance; public static T Instance { get { if (DataSingleton.m_instance == null) { DataSingleton.m_instance = Activator.CreateInstance(); if (DataSingleton.m_instance != null) { (DataSingleton.m_instance as DataSingleton).Init(); } } return DataSingleton.m_instance; } } public static void Release() { if (DataSingleton.m_instance != null) { DataSingleton.m_instance = (T) ((object) null); } } public void Startup() { } public abstract void Init(); public abstract void OnDispose(); }