IServiceContainer.RemoveService Method

Definition

Removes the specified service type from the service container.

Overloads

RemoveService(Type)

Removes the specified service type from the service container.

RemoveService(Type, Boolean)

Removes the specified service type from the service container, and optionally promotes the service to parent service containers.

RemoveService(Type)

Removes the specified service type from the service container.

public:
 void RemoveService(Type ^ serviceType);
public void RemoveService (Type serviceType);
abstract member RemoveService : Type -> unit
Public Sub RemoveService (serviceType As Type)

Parameters

serviceType
Type

The type of service to remove.

Examples

The following example demonstrates how to remove a service from an IServiceContainer.

m_MyServiceContainer->RemoveService( Control::typeid );
m_MyServiceContainer.RemoveService(typeof(Control));
m_MyServiceContainer.RemoveService(GetType(Control))

Applies to

RemoveService(Type, Boolean)

Removes the specified service type from the service container, and optionally promotes the service to parent service containers.

public:
 void RemoveService(Type ^ serviceType, bool promote);
public void RemoveService (Type serviceType, bool promote);
abstract member RemoveService : Type * bool -> unit
Public Sub RemoveService (serviceType As Type, promote As Boolean)

Parameters

serviceType
Type

The type of service to remove.

promote
Boolean

true to promote this request to any parent service containers; otherwise, false.

Examples

The following example demonstrates how to remove a service from an IServiceContainer.

m_MyServiceContainer->RemoveService( Control::typeid );
m_MyServiceContainer.RemoveService(typeof(Control));
m_MyServiceContainer.RemoveService(GetType(Control))

Applies to