namespace IFramework { /// /// 基类 /// public abstract class Unit : IUnit { private bool _disposed; /// /// 是否已经释放 /// public bool disposed { get { return _disposed; } } /// /// 释放时 /// protected abstract void OnDispose(); /// /// 释放 /// public virtual void Dispose() { if (_disposed) return; OnDispose(); _disposed = true; } } }