Class DisposeSafety.ScopedFinalizer
Utility class for managing finalizing stuff.
Assembly: Dalamud.dll
View Source
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
public void EnsureCapacity(int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The minimum capacity to ensure. |
Add<T>(T?)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public T? Add<T>(T? d) where T : IDisposable
Returns
<T>
: The parameter.
Parameters
Type | Name |
---|---|
<T> | d |
Type Parameters
T
Add(Action?)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public Action? Add(Action? d)
Returns
System.Action
Parameters
Type | Name |
---|---|
System.Action | d |
Add(Func<Task>?)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public Func<Task>? Add(Func<Task>? d)
Returns
System.Func<System.Threading.Tasks.Task>
Parameters
Type | Name |
---|---|
System.Func<System.Threading.Tasks.Task> | d |
Add(GCHandle)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public GCHandle Add(GCHandle d)
Returns
System.Runtime.InteropServices.GCHandle
Parameters
Type | Name |
---|---|
System.Runtime.InteropServices.GCHandle | d |
AddRange(IEnumerable<IDisposable?>)
Queue all the given System.IDisposable
to be disposed later.
View Source
public void AddRange(IEnumerable<IDisposable?> ds)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.IDisposable> | ds | Disposables. |
AddRange(IEnumerable<Action?>)
Queue all the given System.IDisposable
to be run later.
View Source
public void AddRange(IEnumerable<Action?> ds)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Action> | ds | Actions. |
AddRange(IEnumerable<Func<Task>?>)
Queue all the given System.Func%601
returning System.Threading.Tasks.Task
to be run later.
View Source
public void AddRange(IEnumerable<Func<Task>?> ds)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Func<System.Threading.Tasks.Task>> | ds | Func{Task}s. |
AddRange(IEnumerable<GCHandle>)
Queue all the given System.Runtime.InteropServices.GCHandle
to be disposed later.
View Source
public void AddRange(IEnumerable<GCHandle> ds)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Runtime.InteropServices.GCHandle> | ds | GCHandles. |
Cancel()
Cancel all pending disposals.
View Source
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
public DisposeSafety.ScopedFinalizer WithEnsureCapacity(int capacity)
Returns
Dalamud.Utility.DisposeSafety.ScopedFinalizer: The new capacity of this stack.
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | capacity | The minimum capacity to ensure. |
With(IDisposable)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public DisposeSafety.ScopedFinalizer With(IDisposable d)
Returns
Dalamud.Utility.DisposeSafety.ScopedFinalizer: The parameter.
Parameters
Type | Name |
---|---|
System.IDisposable | d |
With(Action)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public DisposeSafety.ScopedFinalizer With(Action d)
Returns
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters
Type | Name |
---|---|
System.Action | d |
With(Func<Task>)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public DisposeSafety.ScopedFinalizer With(Func<Task> d)
Returns
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters
Type | Name |
---|---|
System.Func<System.Threading.Tasks.Task> | d |
With(GCHandle)
Inserts an object at the top of the System.Collections.Generic.Stack%601
.
View Source
public DisposeSafety.ScopedFinalizer With(GCHandle d)
Returns
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters
Type | Name |
---|---|
System.Runtime.InteropServices.GCHandle | d |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
View Source
public void Dispose()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
View Source
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
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
public event Action<DisposeSafety.IDisposeCallback, Exception?>? AfterDispose
Event Type
System.Action<Dalamud.Utility.DisposeSafety.IDisposeCallback,System.Exception>
Implements
- Dalamud.Utility.DisposeSafety.IDisposeCallback
System.IDisposable
System.IAsyncDisposable