using System; namespace IFramework.Singleton { /// /// 单例属性类 /// /// public abstract class SingletonPropertyClass : Unit, ISingleton where T : SingletonPropertyClass { /// /// 实例 /// protected static T instance { get { return SingletonProperty.instance; } } /// /// ctor /// protected SingletonPropertyClass() { } /// /// 初始化 /// protected abstract void OnSingletonInit(); /// /// 注销 /// public override void Dispose() { base.Dispose(); if (!disposed) { SingletonProperty.Dispose(); } } void ISingleton.OnSingletonInit() { OnSingletonInit(); } } }