Container Container Container Container Class

Definition

Encapsulates zero or more components.

public ref class Container : IDisposable, System::ComponentModel::IContainer
public class Container : IDisposable, System.ComponentModel.IContainer
type Container = class
    interface IContainer
    interface IDisposable
Public Class Container
Implements IContainer, IDisposable
Inheritance
ContainerContainerContainerContainer
Derived
Implements

Remarks

The Container class is the default implementation for the IContainer interface.

Containers are objects that encapsulate and track zero or more components. In this context, containment refers to logical containment, not visual containment. You can use components and containers in a variety of scenarios, including scenarios that are both visual and not visual.

The components in a container are tracked in a first-in, first-out list, which also defines the order of the components within the container. Added components are appended to the end of the list.

Constructors

Container() Container() Container() Container()

Initializes a new instance of the Container class.

Properties

Components Components Components Components

Gets all the components in the Container.

Methods

Add(IComponent) Add(IComponent) Add(IComponent) Add(IComponent)

Adds the specified Component to the Container. The component is unnamed.

Add(IComponent, String) Add(IComponent, String) Add(IComponent, String) Add(IComponent, String)

Adds the specified Component to the Container and assigns it a name.

CreateSite(IComponent, String) CreateSite(IComponent, String) CreateSite(IComponent, String) CreateSite(IComponent, String)

Creates a site ISite for the given IComponent and assigns the given name to the site.

Dispose() Dispose() Dispose() Dispose()

Releases all resources used by the Container.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

Releases the unmanaged resources used by the Container, and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

Releases unmanaged resources and performs other cleanup operations before the Container is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetService(Type) GetService(Type) GetService(Type) GetService(Type)

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

GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(IComponent) Remove(IComponent) Remove(IComponent) Remove(IComponent)

Removes a component from the Container.

RemoveWithoutUnsiting(IComponent) RemoveWithoutUnsiting(IComponent) RemoveWithoutUnsiting(IComponent) RemoveWithoutUnsiting(IComponent)

Removes a component from the Container without setting Site to null.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)
ValidateName(IComponent, String) ValidateName(IComponent, String) ValidateName(IComponent, String) ValidateName(IComponent, String)

Determines whether the component name is unique for this container.

Applies to

See Also