feat:框架基础设施搭建

This commit is contained in:
橙子
2023-04-12 22:52:09 +08:00
parent 5efdffcda8
commit 18696ec542
572 changed files with 26077 additions and 25 deletions

View File

@@ -0,0 +1,27 @@
using System.Diagnostics.CodeAnalysis;
namespace Yi.Framework.Infrastructure.Utils
{
public class DisposeAction<T> : IDisposable
{
private readonly Action<T> _action;
private readonly T _parameter;
/// <summary>
/// Creates a new <see cref="DisposeAction"/> object.
/// </summary>
/// <param name="action">Action to be executed when this object is disposed.</param>
/// <param name="parameter">The parameter of the action.</param>
public DisposeAction(Action<T> action, T parameter)
{
_action = action;
_parameter = parameter;
}
public void Dispose()
{
_action(_parameter);
}
}
}