Container 类

封装零个或更多个组件。

**命名空间:**System.ComponentModel
**程序集:**System(在 system.dll 中)

语法

声明
Public Class Container
    Implements IContainer, IDisposable
用法
Dim instance As Container
public class Container : IContainer, IDisposable
public ref class Container : IContainer, IDisposable
public class Container implements IContainer, IDisposable
public class Container implements IContainer, IDisposable

备注

Container 类是 IContainer 接口的默认实现。

容器是封装和跟踪零个或更多个组件的对象。在此上下文中,包容是指逻辑包容,而不是直观包容。可以在多种方案下使用组件和容器,包括可视化方案和非可视化方案。

在一个先入先出列表中跟踪容器中的组件,该列表也定义了容器内组件的顺序。所添加的组件会附加到列表的结尾。

提示

应用于此类的 HostProtectionAttribute 属性 (Attribute) 具有以下 Resources 属性 (Property) 值:SharedStateHostProtectionAttribute 不影响桌面应用程序(桌面应用程序一般通过双击图标,键入命令或在浏览器中输入 URL 启动)。有关更多信息,请参见 HostProtectionAttribute 类或 SQL Server 编程和宿主保护属性

继承层次结构

System.Object
  System.ComponentModel.Container
     System.ComponentModel.NestedContainer

线程安全

此类型的任何公共静态(Visual Basic 中的 Shared)成员都是线程安全的,但不保证所有实例成员都是线程安全的。

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:2.0、1.0

请参见

参考

Container 成员
System.ComponentModel 命名空间
IContainer
IComponent
Component 类