Component Class
Collapse the table of content
Expand the table of content

Component Class

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


Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

public class Component : MarshalByRefObject, IComponent, 

The Component type exposes the following members.

Public methodSupported by the XNA FrameworkComponentInitializes a new instance of the Component class.

Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event.
Public propertyContainerGets the IContainer that contains the Component.
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode.
Protected propertySupported by the XNA FrameworkEventsGets the list of event handlers that are attached to this Component.
Public propertySupported by the XNA FrameworkSiteGets or sets the ISite of the Component.

Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkDispose()Releases all resources used by the Component.
Protected methodSupported by the XNA FrameworkDispose(Boolean)Releases the unmanaged resources used by the Component and optionally releases the managed resources.
Public methodSupported by the XNA FrameworkEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by the XNA FrameworkFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Overrides Object.Finalize().)
Public methodSupported by the XNA FrameworkGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container.
Public methodSupported by the XNA FrameworkGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodSupported by the XNA FrameworkMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodSupported by the XNA FrameworkToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Overrides Object.ToString().)

In XNA Framework 3.0, this member is inherited from Object.ToString().

Public eventSupported by the XNA FrameworkDisposedOccurs when the component is disposed by a call to the Dispose method.

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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Community Additions

© 2015 Microsoft