2024-06-19 14:30:45 +00:00
|
|
|
namespace TimePasses.Util;
|
2024-06-17 17:25:46 +00:00
|
|
|
|
|
|
|
internal class OnDispose : IDisposable {
|
|
|
|
private bool _disposed;
|
|
|
|
private readonly Action _action;
|
|
|
|
|
|
|
|
internal OnDispose(Action action) {
|
|
|
|
this._action = action;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Dispose() {
|
|
|
|
if (this._disposed) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this._disposed = true;
|
|
|
|
this._action();
|
|
|
|
}
|
|
|
|
}
|