API ReferenceSandbox.Utility

DisposeActionclass

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

objectDisposeAction
Namespace
Sandbox.Utility
Assembly
Sandbox.System
Declaration
public sealed struct Sandbox.Utility.DisposeAction

Constructors1

Showing 1 constructors

public DisposeAction(System.Action action)PUBLICCONSTRUCTOR

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

ParameterTypeDescription
actionActionThe action to invoke when disposed

Methods2

Showing 2 methods

public static System.IDisposable Create(System.Action action)PUBLICSTATIC

Factory method to create a DisposeAction as an IDisposable.

ParameterTypeDescription
actionActionThe action to invoke when disposed
Returns:IDisposableA disposable object that will invoke the action

public virtual sealed void Dispose()PUBLICVIRTUAL

Invokes the action specified in the constructor.

Returns:void

On this page