IServiceContainer Interface

 

Provides a container for services.

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

[<ComVisibleAttribute(true)>]
type IServiceContainer = 
    interface
        interface IServiceProvider
    end

NameDescription
System_CAPS_pubmethodAddService(Type, Object)

Adds the specified service to the service container.

System_CAPS_pubmethodAddService(Type, Object, Boolean)

Adds the specified service to the service container, and optionally promotes the service to any parent service containers.

System_CAPS_pubmethodAddService(Type, ServiceCreatorCallback)

Adds the specified service to the service container.

System_CAPS_pubmethodAddService(Type, ServiceCreatorCallback, Boolean)

Adds the specified service to the service container, and optionally promotes the service to parent service containers.

System_CAPS_pubmethodGetService(Type)

Gets the service object of the specified type.(Inherited from IServiceProvider.)

System_CAPS_pubmethodRemoveService(Type)

Removes the specified service type from the service container.

System_CAPS_pubmethodRemoveService(Type, Boolean)

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

A service container is, by definition, a service provider. In addition to providing services, it also provides a mechanism for adding and removing services. Services are a foundation of the .NET Framework design-time architecture. Services provide design-time objects access to specific features and methods implemented by a service object that provides a service or services.

To obtain a service at design time, call the GetService method of a component sited in design mode. Designers and other objects can add or remove services at design time through the IDesignerHost interface.

Service containers can be contained by other service containers, forming a tree of service containers. By default, the IServiceContainer interface adds services to the closest service container. When a service is added, it can be added with instructions to promote it. When a service is promoted, it is added to any parent service container, on up until the top of the service container tree is reached. This allows a designer to provide a global service that other objects in the process can use.

The following code example contains the code for a Form that is configured to demonstrate the behavior of a network of linked service containers.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: