Table of Contents

Class DisposableExtensions

Namespace
FinanceSharp
Assembly
FinanceSharp.dll

Provides extensions methods for IDisposable

public static class DisposableExtensions
Inheritance
DisposableExtensions
Inherited Members

Methods

DisposeSafely(IDisposable)

Calls Dispose() within a try/catch and logs any errors.

public static bool DisposeSafely(this IDisposable disposable)

Parameters

disposable IDisposable

The IDisposable to be disposed

Returns

bool

True if the object was successfully disposed, false if an error was thrown

DisposeSafely(IDisposable, Action<Exception>)

 Calls <xref href="System.IDisposable.Dispose" data-throw-if-not-resolved="false"></xref> within a try/catch and invokes the

errorHandler on any errors.

public static bool DisposeSafely(this IDisposable disposable, Action<Exception> errorHandler)

Parameters

disposable IDisposable

The IDisposable to be disposed

errorHandler Action<Exception>

Error handler delegate invoked if an exception is thrown while calling Dispose()

Returns

bool

True if the object was successfully disposed, false if an error was thrown or the specified disposable was null