Method Free
- Namespace
- PaintDotNet
- Assembly
- PaintDotNet.Fundamentals.dll
Free<T>(ref T?)
Disposes the given object reference, if it is non-null. If the reference is non-null, it will then be set to null.
public static void Free<T>(ref T? disposeMe) where T : class, IDisposable
Parameters
disposeMe
T
Type Parameters
T
Free<T>(ref T?, bool)
Disposes the given object reference, if it is non-null. If the reference is non-null, it will then be set to null.
public static void Free<T>(ref T? disposeMe, bool callerIsNotFinalizing) where T : class, IDisposable
Parameters
disposeMe
TThe object to dispose, if non-null, and set to null afterward.
callerIsNotFinalizing
boolWhether or not the caller is in their finalizer. Pass in the value of 'disposing' from your Dispose(bool disposing) implementation. In all other contexts you should use the other overload of Free().
If this value is false (which will be the case when Dispose(bool) is called from a finalizer), then Dispose() will not be called on disposeMe, and it will not be set to null.
Type Parameters
T
Remarks
This overload of Free() should only be used from a Dispose(bool) method. It is generally not safe to call Dispose() on objects from finalizers, and this method helps manage that.