Class DisposeSafety.ScopedFinalizer
Utility class for managing finalizing stuff.
Assembly: Dalamud.dll​
public class DisposeSafety.ScopedFinalizer : DisposeSafety.IDisposeCallback, IDisposable, IAsyncDisposable
Implements:
Dalamud.Utility.DisposeSafety.IDisposeCallback, System.IDisposable, System.IAsyncDisposable
Methods​
EnsureCapacity(int)​
public void EnsureCapacity(int capacity)
Parameters​
| Type | Name |
|---|---|
System.Int32 | capacity |
Add<T>(T?)​
public T? Add<T>(T? d) where T : IDisposable
Returns​
<T>: The parameter.
Parameters​
| Type | Name |
|---|---|
<T> | d |
Type Parameters​
T
Add(Action?)​
public Action? Add(Action? d)
Returns​
System.Action
Parameters​
| Type | Name |
|---|---|
System.Action | d |
Add(Func<Task>?)​
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)​
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.
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.
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.Func1returningSystem.Threading.Tasks.Task` to be run later.
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.
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.
public void Cancel()
Remarks​
Use this after successful initialization of multiple disposables.
WithEnsureCapacity(int)​
public DisposeSafety.ScopedFinalizer WithEnsureCapacity(int capacity)
Returns​
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters​
| Type | Name |
|---|---|
System.Int32 | capacity |
With(IDisposable)​
public DisposeSafety.ScopedFinalizer With(IDisposable d)
Returns​
Dalamud.Utility.DisposeSafety.ScopedFinalizer: The parameter.
Parameters​
| Type | Name |
|---|---|
System.IDisposable | d |
With(Action)​
public DisposeSafety.ScopedFinalizer With(Action d)
Returns​
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters​
| Type | Name |
|---|---|
System.Action | d |
With(Func<Task>)​
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)​
public DisposeSafety.ScopedFinalizer With(GCHandle d)
Returns​
Dalamud.Utility.DisposeSafety.ScopedFinalizer: This for method chaining.
Parameters​
| Type | Name |
|---|---|
System.Runtime.InteropServices.GCHandle | d |
Dispose()​
public void Dispose()
DisposeAsync()​
public ValueTask DisposeAsync()
Returns​
System.Threading.Tasks.ValueTask
Events​
BeforeDispose​
Event to be fired before object dispose. First parameter is the object iself.
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.
public event Action<DisposeSafety.IDisposeCallback, Exception?>? AfterDispose
Event Type​
System.Action<Dalamud.Utility.DisposeSafety.IDisposeCallback,System.Exception>
Implements​
- Dalamud.Utility.DisposeSafety.IDisposeCallback
System.IDisposableSystem.IAsyncDisposable