Skip to main content
Version: 15.x (API 15) [Current]

Class DisposeSafety

Utilities for disposing stuff.

Assembly: Dalamud.dll​
Declaration
public static class DisposeSafety

Methods​

ToDisposableIgnoreExceptions<T>(Task<T>)​

Returns a proxy System.IDisposable that on dispose will dispose the result of the given System.Threading.Tasks.Task1`.

If any exception has occurred, it will be ignored.

Declaration
public static IDisposable ToDisposableIgnoreExceptions<T>(this Task<T> task) where T : IDisposable
Returns​

System.IDisposable: The proxy System.IDisposable.

Parameters​
TypeNameDescription
System.Threading.Tasks.Task<<T>>taskThe task.
Type Parameters​
NameDescription
TA disposable type.

ToContentDisposedTask<T>(Task<T>, bool)​

Transforms <code class="paramref">task</code> into a System.Threading.Tasks.Task, disposing the content as necessary.

Declaration
public static Task ToContentDisposedTask<T>(this Task<T> task, bool ignoreAllExceptions = false) where T : IDisposable
Returns​

System.Threading.Tasks.Task: A wrapper for the task.

Parameters​
TypeNameDescription
System.Threading.Tasks.Task<<T>>taskThe task.
System.BooleanignoreAllExceptionsIgnore all exceptions.
Type Parameters​
NameDescription
TA disposable type.

AggregateToDisposable<T>(IEnumerable<T>?)​

Returns a proxy System.IDisposable that on dispose will dispose all the elements of the given System.Collections.Generic.IEnumerable1` of <code class="typeparamref">T</code>s.

Declaration
public static IDisposable AggregateToDisposable<T>(this IEnumerable<T>? disposables) where T : IDisposable
Returns​

System.IDisposable: The proxy System.IDisposable.

Parameters​
TypeNameDescription
System.Collections.Generic.IEnumerable<<T>>disposablesThe disposables.
Type Parameters​
NameDescription
TThe disposable types.
Exceptions​

System.AggregateException
Error.