Component Component Component Component Class

Definition

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

public ref class Component : MarshalByRefObject, IDisposable, System::ComponentModel::IComponent
[System.Runtime.InteropServices.ClassInterface]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
public class Component : MarshalByRefObject, IDisposable, System.ComponentModel.IComponent
type Component = class
    inherit MarshalByRefObject
    interface IComponent
    interface IDisposable
Public Class Component
Inherits MarshalByRefObject
Implements IComponent, IDisposable
Inheritance
Derived
Attributes
Implements

Remarks

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 Dispose method, without waiting for automatic memory management through an implicit call to the Finalize method. When a Container is disposed, all components within the Container are also disposed.

Constructors

Component() Component() Component() Component()

Initializes a new instance of the Component class.

Properties

CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents

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

Container Container Container Container

Gets the IContainer that contains the Component.

DesignMode DesignMode DesignMode DesignMode

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

Events Events Events Events

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

Site Site Site Site

Gets or sets the ISite of the Component.

Methods

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Component.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

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

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

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

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

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

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

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

Events

Disposed Disposed Disposed Disposed

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

Applies to

See Also