PartyDamage/OnDispose.cs

19 lines
356 B
C#
Raw Permalink Normal View History

2024-07-25 06:50:32 +00:00
namespace PartyDamage;
public class OnDispose : IDisposable {
private readonly Action _action;
private bool _disposed;
public OnDispose(Action action) {
this._action = action;
}
public void Dispose() {
if (this._disposed) {
return;
}
this._disposed = true;
this._action();
}
}