System.ComponentModel.Component Class

Provides the base implementation for the IComponent interface and enables object sharing between applications.

See Also: Component


public class Component : MarshalByRefObject, IComponent, IDisposable


Component is the base class for all components in the common language runtime that marshal by reference. Component is remotable and derives from the MarshalByRefObject class. Component provides an implementation of the IComponent interface. The MarshalByValueComponent provides an implementation of IComponent that marshals by value.

You can host a Component in any object that implements the IContainer interface, and you can query and get services from its container. The container creates an ISite for each Component it contains. The container uses the site to manage the Component and is used by the Component to communicate with its container.

A Component should release resources explicitly by calls to its Component.Dispose method, without waiting for automatic memory management through an implicit call to the Object.Finalize method. When a Container is disposed, all components within the Container are also disposed.


Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,

The members of System.ComponentModel.Component are listed below.

See Also: MarshalByRefObject

Public Constructors

Initializes a new instance of the Component class.

Public Properties


Gets the IContainer that contains the Component.


Gets or sets the ISite of the Component.

Protected Properties


Gets a value indicating whether the component can raise an event.


Gets a value that indicates whether the Component is currently in design mode.


Gets the list of event handlers that are attached to this Component.

Public Methods


Releases all resources used by the Component.


Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.

ToString() : String

Returns a String containing the name of the Component, if any. This method should not be overridden.

Protected Methods


Releases the unmanaged resources used by the Component and optionally releases the managed resources.

GetService(Type) : Object

Returns an object that represents a service provided by the Component or by its Container.

Public Events


Occurs when the component is disposed by a call to the Component.Dispose method.