System 2.0.0.0 4.0.0.0 System.ComponentModel.Container System.ComponentModel.INestedContainer System.IDisposable

The class is a simple implementation of the interface, which defines a component that logically contains zero or more other components and is owned by a parent component. The behavior of nested containers differs from a standard in a number of ways, including the following:

Site characteristics such as and are routed through the owning component’s site.

The site’s property is a qualified name that includes the owning component’s name followed by a period (.) and the child component’s name.

provides support for the as a service.

When the owning component is disposed, the container is disposed as well.

In addition, designers treat nested containers differently. A designer host is only interested in one container—the one associated with the host. Therefore, component add and remove events are not raised when a component is added to or removed from a nested container. However, because services flow through to the nested container, component change events are raised when a component in a nested container is changed.

This disparity in event tracking also impacts undo functionality, which is closely tied to serialization. The standard undo engine uses to track changes made to components. If the undo engine cannot identify a name for a component through the reference service, the engine will ignore any changes for that component. This service automatically recognizes changes to contained components only if they are exposed as public read-only properties of the same name in their owners. Otherwise, the developer must pass component change events up to the owner. For example, if a nested component’s Text property is resurfaced on its owning component as an Address property, when the Text property is changed, a property change must be programmatically made for the corresponding Address property or else that change will not be tracked by undo.

Provides the base implementation for the interface, which enables containers to have an owning component.

- Constructor
  2.0.0.0
  4.0.0.0

  This constructor enlists in its owner's event so that the nested container's method will automatically be called.

  Initializes a new instance of the class.

  The that owns this nested container.
- Method
  2.0.0.0
  4.0.0.0
  System.ComponentModel.ISite `` ``

  If the parameter is null, the is added to the nested container without an identifying name.

  Creates a site for the component within the container.

  The newly created .

  The to create a site for. The name to assign to , or null to skip the name assignment.
- Method
  2.0.0.0
  4.0.0.0
  System.Void ``

  This method is called by the public Dispose() method and the method. Dispose() invokes the protected Dispose(Boolean) method with the parameter set to true. invokes Dispose with set to false.

  When the parameter is true, this method releases all resources held by any managed objects that this references. This method invokes the Dispose() method of each referenced object.

  Releases the resources used by the nested container.

  true to release both managed and unmanaged resources; false to release only unmanaged resources.
- Method
  2.0.0.0
  4.0.0.0
  System.Object ``

  This method overrides the method. This implementation only resolves requests for the and services.

  Gets the service object of the specified type, if it is available.

  An that implements the requested service, or null if the service cannot be resolved.

  The of the service to retrieve.
- Property
  2.0.0.0
  4.0.0.0
  System.ComponentModel.IComponent To be added.

  The owning component is the characteristic that differentiates nested containers from ordinary containers.

  Gets the owning component for this nested container.

- Property
  2.0.0.0
  4.0.0.0
  System.String To be added.

  This property may be overridden to provide a custom owner name. The default implementation searches the owner's site for and calls , or if there is no nested site. If neither is available, this property returns null.

  Gets the name of the owning component.