ComboBox.ObjectCollection 类

此类支持 .NET 基础结构,但不适合在代码中直接使用。

代表 ComboBox 中项的集合。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Class ObjectCollection
    Implements IList, ICollection, IEnumerable
用法
Dim instance As ObjectCollection
public class ObjectCollection : IList, ICollection, IEnumerable
public ref class ObjectCollection : IList, ICollection, IEnumerable
public class ObjectCollection implements IList, ICollection, 
    IEnumerable
public class ObjectCollection implements IList, ICollection, 
    IEnumerable

备注

System.Windows.Forms.ComboBox.ObjectCollection 类封装 ComboBox 中的项。组合框的对象集合可用于管理许多类型的对象,包括字符串、图像和自定义业务对象。

您可以用几种方法向该集合添加项。Add 方法向该集合添加一个对象。若要向该集合添加多个对象,最好创建一个项数组,并用 AddRange 方法分配。若要将一个对象插入集合内的特定位置,可以使用 Insert 方法。若要移除集合中已知索引处的项,可以使用 Remove 方法或 RemoveAt 方法。Clear 方法移除集合中的所有项。

除了添加项和移除项的方法和属性以外,System.Windows.Forms.ComboBox.ObjectCollection 还提供在集合内查找项的方法。Contains 方法使您能够确定某对象是否为集合的成员。知道项位于集合中后,可以使用 IndexOf 方法来确定项在集合中的位置。

继承层次结构

System.Object
  System.Windows.Forms.ComboBox.ObjectCollection

线程安全

此类型的任何公共静态(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

请参见

参考

ComboBox.ObjectCollection 成员
System.Windows.Forms 命名空间