This documentation is archived and is not being maintained.

IServiceContainer.AddService Method (Type, Object)

Adds the specified service to the service container.

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

void AddService (
	Type serviceType,
	Object serviceInstance
)
void AddService (
	Type serviceType, 
	Object serviceInstance
)
function AddService (
	serviceType : Type, 
	serviceInstance : Object
)
Not applicable.

Parameters

serviceType

The type of service to add.

serviceInstance

An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter.

The following example illustrates how to add a service to an IServiceContainer.

m_MyServiceContainer.AddService(typeof(Control), sender);

mMyServiceContainer.AddService(Control.class.ToType(), sender);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: