Table of Contents

Method SafeDisposeSuppressException

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

SafeDisposeSuppressException<T>(ref T?)

Safely disposes of the specified disposable object, suppressing any exceptions that occur during disposal.

public static void SafeDisposeSuppressException<T>(ref T? disposable) where T : IDisposable

Parameters

disposable T

A reference to the disposable object to be disposed. The reference is set to null after disposal.

Type Parameters

T

The type of the disposable object, which must implement IDisposable.

Remarks

This method ensures that the disposal of the object does not propagate exceptions, which can be useful in scenarios where disposal failures should not disrupt the execution flow. Any exceptions encountered during disposal are logged using WriteLine(string).