|
|
|
@ -28,10 +28,21 @@ public class DisposeAction : IDisposable |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// This class can be used to provide an action when
|
|
|
|
/// Dipose method is called.
|
|
|
|
/// </summary>
|
|
|
|
public class DisposeAction<T> : IDisposable |
|
|
|
{ |
|
|
|
private readonly Action<T> _action; |
|
|
|
[CanBeNull] private readonly T _parameter; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new <see cref="DisposeAction"/> object.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="action">Action to be executed when this object is disposed.</param>
|
|
|
|
/// /// <param name="parameter">The parameter of the action.</param>
|
|
|
|
/// <typeparam name="T">The type of the parameter of the action.</typeparam>
|
|
|
|
public DisposeAction(Action<T> action, T parameter) |
|
|
|
{ |
|
|
|
Check.NotNull(action, nameof(action)); |
|
|
|
|