In This Article

MarshalByRefDisposableObject Class

Provides a base class that implements the IDisposable interface. This class functions in accordance with the Disposable design pattern.

public abstract class MarshalByRefDisposableObject : MarshalByRefObject, IDisposable
Inheritance:
object MarshalByRefObject object
Derived:
PopupMenu LogicalTreeNodeBase LogicalTreeNodeCollection
Implements:
IDisposable

Constructors

MarshalByRefDisposableObject()

Initializes an instance of the class.

protected MarshalByRefDisposableObject()

Properties

IsDisposed

Indicates whether the object has been disposed.

[Browsable(false)]
public bool IsDisposed { get; }

Property Value

bool:

true if the object has been disposed; otherwise, false.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

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

true to release both managed and unmanaged resources; false to release only unmanaged resources.

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.

~MarshalByRefDisposableObject()

Allows an object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.

protected ~MarshalByRefDisposableObject()

VerifyNotDisposed()

Throws an ObjectDisposedException if the object has already been disposed.

public void VerifyNotDisposed()

Events

Disposed

Occurs when the object is disposed.

public event EventHandler? Disposed

Event Type

EventHandler

Inherited Members

Extension Methods