mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 11:14:30 +08:00
- 将所有文件中的命名空间GFramework替换为GWFramework - 更新项目文件GFramework.csproj中的包ID和产品名称为GWFramework - 修改解决方案文件GFramework.sln中项目的引用名称为GWFramework - 替换LazyThreadSafetyMode的完整命名空间引用 - 统一调整各模块间相互引用的命名空间前缀
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
namespace GWFramework.framework.events;
|
|
|
|
|
|
/// <summary>
|
|
/// 取消注册列表类,用于管理多个需要取消注册的对象
|
|
/// </summary>
|
|
public class UnRegisterList : IUnRegisterList
|
|
{
|
|
private readonly List<IUnRegister> _unRegisterList = [];
|
|
|
|
/// <summary>
|
|
/// 向取消注册列表中添加一个新的可取消注册对象
|
|
/// </summary>
|
|
/// <param name="unRegister">需要添加到列表中的可取消注册对象</param>
|
|
public void Add(IUnRegister unRegister)
|
|
{
|
|
_unRegisterList.Add(unRegister);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 对列表中的所有对象执行取消注册操作,并清空列表
|
|
/// </summary>
|
|
public void UnRegisterAll()
|
|
{
|
|
// 遍历所有注册项并执行取消注册
|
|
foreach (var t in _unRegisterList)
|
|
{
|
|
t.UnRegister();
|
|
}
|
|
|
|
// 清空列表
|
|
_unRegisterList.Clear();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取取消注册列表的只读属性
|
|
/// </summary>
|
|
public List<IUnRegister> UnregisterList { get; }
|
|
}
|