Skip to main content

Class DisposeSafety.ScopedFinalizer

Utility class for managing finalizing stuff.

Assembly: Dalamud.dll
View Source
Declaration
public class DisposeSafety.ScopedFinalizer : DisposeSafety.IDisposeCallback, IDisposable, IAsyncDisposable

Implements:
Dalamud.Utility.DisposeSafety.IDisposeCallback, System.IDisposable, System.IAsyncDisposable

Methods

EnsureCapacity(int)

Ensures that the capacity of this Stack is at least the specified <code class="paramref">capacity</code>. If the current capacity is less than <code class="paramref">capacity</code>, it is successively increased to twice the current capacity until it is at least the specified <code class="paramref">capacity</code>.

View Source
Declaration
public void EnsureCapacity(int capacity)
Parameters
TypeNameDescription
System.Int32capacityThe minimum capacity to ensure.

Add<T>(T?)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public T? Add<T>(T? d) where T : IDisposable
Returns

<T>: The parameter.

Parameters
TypeName
<T>d
Type Parameters
  • T

Add(Action?)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public Action? Add(Action? d)
Returns

System.Action

Parameters
TypeName
System.Actiond

Add(Func<Task>?)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public Func<Task>? Add(Func<Task>? d)
Returns

System.Func<System.Threading.Tasks.Task>

Parameters
TypeName
System.Func<System.Threading.Tasks.Task>d

Add(GCHandle)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public GCHandle Add(GCHandle d)
Returns

System.Runtime.InteropServices.GCHandle

Parameters
TypeName
System.Runtime.InteropServices.GCHandled

AddRange(IEnumerable<IDisposable?>)

Queue all the given System.IDisposable to be disposed later.

View Source
Declaration
public void AddRange(IEnumerable<IDisposable?> ds)
Parameters
TypeNameDescription
System.Collections.Generic.IEnumerable<System.IDisposable>dsDisposables.

AddRange(IEnumerable<Action?>)

Queue all the given System.IDisposable to be run later.

View Source
Declaration
public void AddRange(IEnumerable<Action?> ds)
Parameters
TypeNameDescription
System.Collections.Generic.IEnumerable<System.Action>dsActions.

AddRange(IEnumerable<Func<Task>?>)

Queue all the given System.Func%601 returning System.Threading.Tasks.Task to be run later.

View Source
Declaration
public void AddRange(IEnumerable<Func<Task>?> ds)
Parameters
TypeNameDescription
System.Collections.Generic.IEnumerable<System.Func<System.Threading.Tasks.Task>>dsFunc{Task}s.

AddRange(IEnumerable<GCHandle>)

Queue all the given System.Runtime.InteropServices.GCHandle to be disposed later.

View Source
Declaration
public void AddRange(IEnumerable<GCHandle> ds)
Parameters
TypeNameDescription
System.Collections.Generic.IEnumerable<System.Runtime.InteropServices.GCHandle>dsGCHandles.

Cancel()

Cancel all pending disposals.

View Source
Declaration
public void Cancel()

WithEnsureCapacity(int)

Ensures that the capacity of this Stack is at least the specified <code class="paramref">capacity</code>. If the current capacity is less than <code class="paramref">capacity</code>, it is successively increased to twice the current capacity until it is at least the specified <code class="paramref">capacity</code>.

View Source
Declaration
public DisposeSafety.ScopedFinalizer WithEnsureCapacity(int capacity)
Returns

Dalamud.Utility.DisposeSafety.ScopedFinalizer: The new capacity of this stack.

Parameters
TypeNameDescription
System.Int32capacityThe minimum capacity to ensure.

With(IDisposable)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public DisposeSafety.ScopedFinalizer With(IDisposable d)
Returns

Dalamud.Utility.DisposeSafety.ScopedFinalizer: The parameter.

Parameters
TypeName
System.IDisposabled

With(Action)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public DisposeSafety.ScopedFinalizer With(Action d)
Returns

Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.

Parameters
TypeName
System.Actiond

With(Func<Task>)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public DisposeSafety.ScopedFinalizer With(Func<Task> d)
Returns

Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.

Parameters
TypeName
System.Func<System.Threading.Tasks.Task>d

With(GCHandle)

Inserts an object at the top of the System.Collections.Generic.Stack%601.

View Source
Declaration
public DisposeSafety.ScopedFinalizer With(GCHandle d)
Returns

Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.

Parameters
TypeName
System.Runtime.InteropServices.GCHandled

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
Declaration
public void Dispose()

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

View Source
Declaration
public ValueTask DisposeAsync()
Returns

System.Threading.Tasks.ValueTask: A task that represents the asynchronous dispose operation.## Events

BeforeDispose

Event to be fired before object dispose. First parameter is the object iself.

View Source
Declaration
public event Action<DisposeSafety.IDisposeCallback>? BeforeDispose
Event Type

System.Action<Dalamud.Utility.DisposeSafety.IDisposeCallback>

AfterDispose

Event to be fired after object dispose. First parameter is the object iself.

View Source
Declaration
public event Action<DisposeSafety.IDisposeCallback, Exception?>? AfterDispose
Event Type

System.Action<Dalamud.Utility.DisposeSafety.IDisposeCallback,System.Exception>

Implements