public readonly bool IsActiveGets a value indicating whether this guard is still active and will run on disposal.
All Types / Ferrous.Guard
public ref struct ScopeGuard : IDisposable
A stack-allocated scope guard that executes a callback when disposed (exiting a using scope), unless dismissed beforehand. Equivalent to Rust's Drop / defer pattern.
public readonly bool IsActiveGets a value indicating whether this guard is still active and will run on disposal.
public static ScopeGuard Defer(Action onDispose)Creates a new scope guard that executes onDispose when leaving scope.
onDisposepublic static ScopeGuard<TState> Defer<TState>(TState state, Action<TState> onDispose)Creates a zero-allocation scope guard passing explicit state to a static callback, avoiding closure heap allocations.
TStatestateonDispose.onDisposestatic lambda).public void Dismiss()Disarms the guard so that disposing it becomes a no-op (useful for commit/rollback flows).
public void Dispose()Executes the deferred callback if the guard has not been dismissed or already disposed.