Skip to main content
.NET Framework Class Library
Component Class

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

Inheritance Hierarchy
SystemObject
   SystemMarshalByRefObject
    System.ComponentModelComponent
      More...

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)
Syntax
<[%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_0%](True)> _
<[%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_1%]([%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_2%].AutoDispatch)> _
Public Class Component _
	Inherits [%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_3%] _
	Implements [%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_4%], [%$TOPIC/9wbadbce_en-us_VS_110_3_0_0_0_5%]
[[%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_0%](true)]
[[%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_1%]([%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_2%].AutoDispatch)]
public class Component : [%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_3%], [%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_4%], 
	[%$TOPIC/9wbadbce_en-us_VS_110_3_0_1_0_5%]
[[%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_0%](true)]
[[%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_1%]([%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_2%]::AutoDispatch)]
public ref class Component : public [%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_3%], 
	[%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_4%], [%$TOPIC/9wbadbce_en-us_VS_110_3_0_2_0_5%]
[<[%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_0%](true)>]
[<[%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_1%]([%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_2%].AutoDispatch)>]
type Component =  
    class 
        inherit [%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_3%] 
        interface [%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_4%] 
        interface [%$TOPIC/9wbadbce_en-us_VS_110_3_0_3_0_5%] 
    end

The Component type exposes the following members.

Constructors
  NameDescription
Public method Supported by the XNA Framework ComponentInitializes a new instance of the Component class.
Top
Properties
  NameDescription
Protected property CanRaiseEventsGets a value indicating whether the component can raise an event.
Public property ContainerGets the IContainer that contains the Component.
Protected property DesignModeGets a value that indicates whether the Component is currently in design mode.
Protected property Supported by the XNA Framework EventsGets the list of event handlers that are attached to this Component.
Public property Supported by the XNA Framework SiteGets or sets the ISite of the Component.
Top
Methods
  NameDescription
Public method CreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public method Supported by the XNA Framework DisposeReleases all resources used by the Component.
Protected method Supported by the XNA Framework Dispose(Boolean)Releases the unmanaged resources used by the Component and optionally releases the managed resources.
Public method Supported by the XNA Framework Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Supported by the XNA Framework FinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Overrides ObjectFinalize.)
Public method Supported by the XNA Framework GetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public method GetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method GetServiceReturns an object that represents a service provided by the Component or by its Container.
Public method Supported by the XNA Framework GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method InitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected method Supported by the XNA Framework MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected method MemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public method Supported by the XNA Framework ToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Overrides ObjectToString.)

In XNA Framework 3.0, this member is inherited from Object ToString.
Top
Events
  NameDescription
Public event Supported by the XNA Framework DisposedOccurs when the component is disposed by a call to the Dispose method.
Top
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.

Version Information

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Inheritance Hierarchy
SystemObject
   SystemMarshalByRefObject
    System.ComponentModelComponent
       Microsoft.VisualBasic.Compatibility.VB6BaseControlArray
       System.CodeDom.CompilerCodeDomProvider
       System.ComponentModelBackgroundWorker
       System.Configuration.InstallInstaller
       System.Data.CommonDataAdapter
       System.Data.CommonDbCommand
       System.Data.CommonDbCommandBuilder
       System.Data.CommonDbConnection
       System.DiagnosticsEventLog
       System.DiagnosticsEventLogEntry
       System.DiagnosticsPerformanceCounter
       System.DiagnosticsProcess
       System.DiagnosticsProcessModule
       System.DiagnosticsProcessThread
       System.DirectoryServicesDirectoryEntry
       System.DirectoryServicesDirectorySearcher
       System.Drawing.PrintingPrintDocument
       System.IOFileSystemWatcher
       System.IO.PortsSerialPort
       System.ManagementManagementBaseObject
       System.ManagementManagementEventWatcher
       System.ManagementManagementObjectSearcher
       System.MediaSoundPlayer
       System.MessagingMessage
       System.MessagingMessageQueue
       System.Net.NetworkInformationPing
       System.NetWebClient
       System.Runtime.Remoting.ServicesRemotingClientProxy
       System.Runtime.Remoting.ServicesRemotingService
       System.ServiceProcessServiceBase
       System.ServiceProcessServiceController
       System.TimersTimer
       System.Web.Services.ProtocolsWebClientProtocol
       System.Web.UI.WebControlsStyle
       System.Windows.FormsBindingSource
       System.Windows.FormsColumnHeader
       System.Windows.FormsCommonDialog
       System.Windows.FormsControl
       System.Windows.FormsDataGridColumnStyle
       System.Windows.FormsDataGridTableStyle
       System.Windows.Forms.DesignFolderNameEditorFolderBrowser
       System.Windows.FormsErrorProvider
       System.Windows.FormsHelpProvider
       System.Windows.FormsImageList
       System.Windows.FormsMenu
       System.Windows.FormsNotifyIcon
       System.Windows.FormsStatusBarPanel
       System.Windows.FormsTimer
       System.Windows.FormsToolBarButton
       System.Windows.FormsToolStripItem
       System.Windows.FormsToolStripPanelRow
       System.Windows.FormsToolTip