DisposableUtil
Description
Provides static helper method for dealing with IDisposables.
- See also
Public / Methods
DisposeAll
2 overloads
Disposes all given objects and sets the corresponding array elements to null
.
The variable that holds the given disposables in must be cleared to null
after this method has returned in order to guarantee correct resource management.
Disposes all given objects.
The variable that holds the given disposables in must be cleared to null
after this method has returned in order to guarantee correct resource management.
DisposeOrDelete
Disposes the given object if it is an instance of IDisposable, otherwise deletes it if it is an instance of IDeletable, otherwise performs no action.
Using this method circumvents the coding rules for ownership and should be used only in specific scenarios. For usual cases, please use CX.Dispose.
DisposeValues
Disposes all value objects of the given dictionary.
The variable that holds the given disposables in must be cleared to null
after this method has returned in order to guarantee correct resource management.
IsDisposed
Tests if the given object is no longer valid (i.e. it has left the LifecycleState.Initialized state).
IsValid
Is this object valid (see remarks)?
An object is considered valid if it is in one of the following lifecycle states:
-
LifecycleState.Disposing (the IDisposable.Dispose method is being called).
A non-null object that does not implement the ILifecycleState interface is always valid. Null objects are always invalid.