DisposableObject Class
Provides a base class that implements the IDisposable interface. This class functions in accordance with the Disposable design pattern.
public abstract class DisposableObject : MarshalByRefObject, IDisposable- Inheritance:
- object MarshalByRefObject object
- Derived:
- PopupMenu CanvasDrawContext UIRenderer WindowsColorScheme XamlGlyphImageRepository LogicalTreeNodeBase LogicalTreeNodeCollection
- Implements:
- IDisposable
Constructors
DisposableObject()
Initializes a new instance of the DisposableObject class.
public DisposableObject()Remarks
The default constructor initializes all fields to their default values.
Properties
IsDisposed
Gets whether the object has been disposed.
[Browsable(false)]
public bool IsDisposed { get; }Property Value
- bool:
- trueif the object has been disposed; otherwise,- false.
Methods
Dispose()
Releases all resources used by the object.
public void Dispose()Dispose(bool)
Releases the unmanaged resources used by the object and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)| Parameter | Type | Description | 
|---|---|---|
| disposing | bool | 
 | 
Remarks
This method is called by the public Dispose method and the Finalize method.
Dispose invokes this method with the disposing parameter set to true.
Finalize invokes this method with disposing set to false.
~DisposableObject()
Allows an object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.
protected ~DisposableObject()VerifyNotDisposed()
Throws an ObjectDisposedException if the object has already been disposed.
public void VerifyNotDisposed()Events
Disposed
Occurs when the object is disposed.