ListView.CheckedListViewItemCollection 类      
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示在列表视图控件中已选中项的集合。
public: ref class ListView::CheckedListViewItemCollection : System::Collections::IListpublic class ListView.CheckedListViewItemCollection : System.Collections.IList[System.ComponentModel.ListBindable(false)]
public class ListView.CheckedListViewItemCollection : System.Collections.IListtype ListView.CheckedListViewItemCollection = class
    interface IList
    interface ICollection
    interface IEnumerable[<System.ComponentModel.ListBindable(false)>]
type ListView.CheckedListViewItemCollection = class
    interface IList
    interface ICollection
    interface IEnumerablePublic Class ListView.CheckedListViewItemCollection
Implements IList- 继承
- 
				ListView.CheckedListViewItemCollection
- 属性
- 实现
注解
将 ListView.CheckedListViewItemCollection 选中的项存储在 控件中 ListView 。 仅当控件的 属性设置为 true时CheckBoxes,ListView才能检查项。 中 ListView.CheckedListViewItemCollection 存储的项是 中包含的 ListView.ListViewItemCollection项。 类 ListView.ListViewItemCollection 存储控件中显示的 ListView 所有项。
下表显示了 如何在 ListView.ListViewItemCollection 示例控件中存储 的 ListView 项及其选择状态的示例 ListView 。
| 索引 | Item | ListView 中的选中状态 | 
|---|---|---|
| 0 | Item1 | 未选中 | 
| 1 | Item2 | 已选中 | 
| 2 | Item3 | 未选中 | 
| 3 | Item4 | 已选中 | 
| 4 | Item5 | 已选中 | 
根据上 ListView.ListViewItemCollection 表中的示例,下表演示了 的显示方式 ListView.CheckedListViewItemCollection 。
| 索引 | ListViewItemCollection 中的选中项 | 
|---|---|
| 0 | Item2 | 
| 1 | Item4 | 
| 2 | Item5 | 
可以使用此类的属性和方法通过 集合执行各种任务。 使用 Contains 方法可以确定 类中的 ListView.ListViewItemCollection 项是否为 的成员 ListView.CheckedListViewItemCollection。 知道项在集合中后,可以使用 IndexOf 方法确定项在 中 ListView.CheckedListViewItemCollection的位置。
构造函数
| ListView.CheckedListViewItemCollection(ListView) | 初始化 ListView.CheckedListViewItemCollection 类的新实例。 | 
属性
| Count | 获取集合中的项数。 | 
| IsReadOnly | 获取一个值,该值指示集合是否为只读。 | 
| Item[Int32] | 获取集合中指定索引处的项。 | 
| Item[String] | 从集合中获取具有指定键的项。 | 
方法
| Contains(ListViewItem) | 确定指定项是否位于集合内。 | 
| ContainsKey(String) | 确定具有指定键的列是否包含在集合中。 | 
| CopyTo(Array, Int32) | 将整个集合复制到现有数组中,从该数组内的指定位置开始复制。 | 
| Equals(Object) | 确定指定对象是否等于当前对象。(继承自 Object) | 
| GetEnumerator() | 返回一个可用于循环访问选定的项集合的枚举数。 | 
| GetHashCode() | 作为默认哈希函数。(继承自 Object) | 
| GetType() | 获取当前实例的 Type。(继承自 Object) | 
| IndexOf(ListViewItem) | 返回指定的项在集合中的索引。 | 
| IndexOfKey(String) | 确定具有指定键的项的索引。 | 
| MemberwiseClone() | 创建当前 Object 的浅表副本。(继承自 Object) | 
| ToString() | 返回表示当前对象的字符串。(继承自 Object) | 
显式接口实现
| ICollection.IsSynchronized | 获取一个值,该值指示是否同步对 ListView.CheckedListViewItemCollection 的访问(线程安全)。 | 
| ICollection.SyncRoot | 获取可用于同步控件集合访问的对象。 | 
| IList.Add(Object) | 向集合中添加一项。 | 
| IList.Clear() | 从集合中移除所有项。 | 
| IList.Contains(Object) | 验证该项是否已选中。 | 
| IList.IndexOf(Object) | 返回指定的项在集合中的索引。 | 
| IList.Insert(Int32, Object) | 将某个项插入到集合中的指定索引处。 | 
| IList.IsFixedSize | 获取一个值,该值指示集合是否具有固定大小。 | 
| IList.Item[Int32] | 从集合中获取或设置对象。 | 
| IList.Remove(Object) | 从集合中移除某项的第一个匹配项。 | 
| IList.RemoveAt(Int32) | 从集合中移除位于指定索引处的项。 | 
扩展方法
| Cast<TResult>(IEnumerable) | 将 IEnumerable 的元素强制转换为指定的类型。 | 
| OfType<TResult>(IEnumerable) | 根据指定类型筛选 IEnumerable 的元素。 | 
| AsParallel(IEnumerable) | 启用查询的并行化。 | 
| AsQueryable(IEnumerable) | 将 IEnumerable 转换为 IQueryable。 |