C# Action on dispose

Date: 2020-02-20
private class DisposableAction : IDisposable
{
	private readonly Action action;
	public DisposableAction(Action action)
	{
		this.action = action ?? throw new ArgumentNullException(nameof(action));
	}
	public void Dispose()
	{
		action();
	}
}
35170cookie-checkC# Action on dispose