Class DisposeSafety
Utilities for disposing stuff.
Assembly: Dalamud.dll
View Source
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.Task%601
.
If any exception has occurred, it will be ignored.
View Source
Declaration
public static IDisposable ToDisposableIgnoreExceptions<T>(this Task<T> task) where T : IDisposable
Returns
System.IDisposable
: The proxy System.IDisposable
.
Parameters
Type | Name | Description |
---|---|---|
System.Threading.Tasks.Task<<T>> | task | The task. |
Type Parameters
Name | Description |
---|---|
T | A disposable type. |
ToContentDisposedTask<T>(Task<T>, bool)
Transforms <code class="paramref">task</code> into a System.Threading.Tasks.Task
, disposing the content as necessary.
View Source
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
Type | Name | Description |
---|---|---|
System.Threading.Tasks.Task<<T>> | task | The task. |
System.Boolean | ignoreAllExceptions | Ignore all exceptions. |
Type Parameters
Name | Description |
---|---|
T | A 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.IEnumerable%601
of <code class="typeparamref">T</code>s.
View Source
Declaration
public static IDisposable AggregateToDisposable<T>(this IEnumerable<T>? disposables) where T : IDisposable
Returns
System.IDisposable
: The proxy System.IDisposable
.
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<<T>> | disposables | The disposables. |
Type Parameters
Name | Description |
---|---|
T | The disposable types. |
Exceptions
System.AggregateException
Error.