Container 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
封装零个或更多个组件。
public ref class Container : IDisposable, System::ComponentModel::IContainerpublic ref class Container : System::ComponentModel::IContainerpublic class Container : IDisposable, System.ComponentModel.IContainerpublic class Container : System.ComponentModel.IContainertype Container = class
    interface IContainer
    interface IDisposablePublic Class Container
Implements IContainer, IDisposablePublic Class Container
Implements IContainer- 继承
- 
				Container
- 派生
- 实现
注解
类 Container 是 接口的默认实现 IContainer 。
容器是封装和跟踪零个或多个组件的对象。 在此上下文中,包含是指逻辑包含,而不是视觉包含。 可以在各种方案中使用组件和容器,包括视觉对象和非可视方案。
容器中的组件在先入先出列表中进行跟踪,该列表还定义容器中组件的顺序。 添加的组件追加到列表的末尾。
构造函数
| Container() | 初始化 Container 类的新实例。 | 
属性
| Components | 获取 Container 中的所有组件。 | 
方法
| Add(IComponent) | |
| Add(IComponent, String) | |
| CreateSite(IComponent, String) | 为给定的 ISite 创建一个站点 IComponent,并将给定名称分配给该站点。 | 
| Dispose() | 释放由 Container 使用的所有资源。 | 
| Dispose(Boolean) | 释放由 Container 占用的非托管资源,还可以另外再释放托管资源。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| Finalize() | 在通过垃圾回收将 Container 回收之前,释放非托管资源并执行其他清理操作。 | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetService(Type) | 获取指定类型的服务对象(如果可用)。 | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| Remove(IComponent) | 从 Container 中移除组件。 | 
| RemoveWithoutUnsiting(IComponent) | |
| ToString() | 返回表示当前对象的字符串。(继承自 Object) | 
| ValidateName(IComponent, String) | 确定组件名称对此容器是否唯一。 |