pla-01/Life/Misc/DelegateUnsubscriber.cs
2019-10-26 16:47:08 +02:00

20 lines
378 B
C#

using System;
using System.Diagnostics.CodeAnalysis;
namespace Life.Misc
{
public class DelegateUnsubscriber : IDisposable
{
private readonly Action _action;
public DelegateUnsubscriber([NotNull] Action action)
{
_action = action;
}
public void Dispose()
{
_action.Invoke();
}
}
}