20 lines
378 B
C#
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();
|
|
}
|
|
}
|
|
} |