Provides a container for services.

See Also: IServiceContainer Members


public interface IServiceContainer : IServiceProvider


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 System.ComponentModel.Component.GetService(Type) method of a component sited in design mode. Designers and other objects can add or remove services at design time through the System.ComponentModel.Design.IDesignerHost interface.

Service containers can be contained by other service containers, forming a tree of service containers. By default, the System.ComponentModel.Design.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.


Namespace: System.ComponentModel.Design
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,