更新框架
This commit is contained in:
1 parent
ef50fa0620
commit
84b28f9672
72 files changed
+2222
-282
No files matched your search
@@ -0,0 +1,15 @@
|
||||
namespace Store.Management.Framework.Utilities;
|
||||
|
||||
/// <summary>在释放时执行一次清理操作,可安全地重复或并发释放。</summary>
|
||||
public sealed class DisposeAction : IDisposable
|
||||
{
|
||||
private Action? _action;
|
||||
|
||||
public DisposeAction(Action action)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(action);
|
||||
_action = action;
|
||||
}
|
||||
|
||||
public void Dispose() => Interlocked.Exchange(ref _action, null)?.Invoke();
|
||||
}
|
||||
Reference in new issue
Block a user