PartyDamage/OnDispose.cs

19 lines
356 B
C#

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();
}
}