Summary

A simple IDisposable that invokes an action when disposed. Useful for creating using-blocks with cleanup logic.

Examples

using ( DisposeAction.Create( () => Console.WriteLine( "Cleanup!" ) ) ) { // Do work } // "Cleanup!" is printed here

Constructors

DisposeAction Creates a new DisposeAction that will invoke the specified action on disposal.

Methods

Dispose Invokes the action specified in the constructor.

Static Methods

Create Factory method to create a DisposeAction as an IDisposable.
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.