namespace Vanara.PInvoke;
/// A disposable context for which a delegate is called at entry and exit.
///
/// This class can be used as follows:
/// using (var ctx = new BeginEndEventContext(h => RegisterForEvents(out h), h => UnregisterForEvents(h)))
/// {
/// // Check to see if begin function succeeded
/// if (!ctx.BeginSucceeded)
/// return;
///
/// // Do some work
/// }
/// // End function has been called
///
public class BeginEndEventContext : IDisposable
{
private readonly Func