ListViewItem.ListViewSubItemCollection ListViewItem.ListViewSubItemCollection ListViewItem.ListViewSubItemCollection ListViewItem.ListViewSubItemCollection Class

定义

表示 ListViewItem.ListViewSubItem 中储存的 ListViewItem 对象的集合。Represents a collection of ListViewItem.ListViewSubItem objects stored in a ListViewItem.

public: ref class ListViewItem::ListViewSubItemCollection : System::Collections::IList
public class ListViewItem.ListViewSubItemCollection : System.Collections.IList
type ListViewItem.ListViewSubItemCollection = class
    interface IList
    interface ICollection
    interface IEnumerable
Public Class ListViewItem.ListViewSubItemCollection
Implements IList
继承
ListViewItem.ListViewSubItemCollectionListViewItem.ListViewSubItemCollectionListViewItem.ListViewSubItemCollectionListViewItem.ListViewSubItemCollection
实现

注解

一个ListViewItem.ListViewSubItemCollection存储ListViewItem.ListViewSubItem对象表示父对象的子项ListViewItemListView控件。A ListViewItem.ListViewSubItemCollection stores ListViewItem.ListViewSubItem objects that represent subitems of a parent ListViewItem in the ListView control. 中仅显示子项ListView控制列中的指定时Columns的属性ListView控件和时间View属性ListView控件设置为DetailsSubitems are only displayed in a ListView control when columns are specified in the Columns property of the ListView control and when the View property of the ListView control is set to Details. 中的子项的顺序ListViewItem.ListViewSubItemCollection确定的列中显示子项ListView控件。The order of subitems in the ListViewItem.ListViewSubItemCollection determines the columns the subitems are displayed in the ListView control.

有多种方法来将子项添加到集合。There are a number of ways to add subitems to the collection. Add方法将添加一个ListViewItem.ListViewSubItem到集合。The Add method adds a single ListViewItem.ListViewSubItem to the collection. 若要添加到集合的子项数,您创建的数组ListViewItem.ListViewSubItem对象,并将其传递给AddRange方法。To add a number of subitems to the collection, you create an array of ListViewItem.ListViewSubItem objects and pass it to the AddRange method. 如果你想要在集合中的特定位置插入一个子项,则可以使用Insert方法。If you want to insert a subitem at a specific location in the collection, you can use the Insert method. 若要删除的子项,可以使用任一Remove方法或RemoveAt方法如果你知道该子项在集合中的位置。To remove subitems, you can use either the Remove method or the RemoveAt method if you know where the subitem is located in the collection. Clear方法使您能够从而不是使用集合中移除所有子项Remove方法一次都删除一个子项。The Clear method enables you to remove all subitems from the collection instead of using the Remove method to remove a single subitem at a time.

除了方法和属性用于添加和删除子项,ListViewItem.ListViewSubItemCollection还提供了在集合中查找的子项的方法。In addition to methods and properties for adding and removing subitems, the ListViewItem.ListViewSubItemCollection also provides methods to find subitems in the collection. Contains方法使您能够确定是否ListViewItem.ListViewSubItem是集合的成员。The Contains method enables you to determine whether a ListViewItem.ListViewSubItem is a member of the collection. 一旦您知道该子项存储在集合中,可以使用IndexOf方法,以确定该子项在集合中的位置。Once you know that the subitem is located in the collection, you can use the IndexOf method to determine where the subitem is located in the collection.

构造函数

ListViewItem.ListViewSubItemCollection(ListViewItem) ListViewItem.ListViewSubItemCollection(ListViewItem) ListViewItem.ListViewSubItemCollection(ListViewItem) ListViewItem.ListViewSubItemCollection(ListViewItem)

初始化 ListViewItem.ListViewSubItemCollection 类的新实例。Initializes a new instance of the ListViewItem.ListViewSubItemCollection class.

属性

Count Count Count Count

获取集合中的子项数。Gets the number of subitems in the collection.

IsReadOnly IsReadOnly IsReadOnly IsReadOnly

获取一个值,该值指示集合是否为只读。Gets a value indicating whether the collection is read-only.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

获取或设置该集合内指定索引处的子项。Gets or sets the subitem at the specified index within the collection.

Item[String] Item[String] Item[String] Item[String]

获取集合中具有指定键的项。Gets an item with the specified key from the collection.

方法

Add(ListViewItem+ListViewSubItem) Add(ListViewItem+ListViewSubItem) Add(ListViewItem+ListViewSubItem) Add(ListViewItem+ListViewSubItem)

将现有的 ListViewItem.ListViewSubItem 添加到集合中。Adds an existing ListViewItem.ListViewSubItem to the collection.

Add(String) Add(String) Add(String) Add(String)

将子项添加到具有指定文本的集合。Adds a subitem to the collection with specified text.

Add(String, Color, Color, Font) Add(String, Color, Color, Font) Add(String, Color, Color, Font) Add(String, Color, Color, Font)

将子项添加到具有指定文本、前景色、背景色和字体设置的集合。Adds a subitem to the collection with specified text, foreground color, background color, and font settings.

AddRange(ListViewItem+ListViewSubItem[]) AddRange(ListViewItem+ListViewSubItem[]) AddRange(ListViewItem+ListViewSubItem[]) AddRange(ListViewItem+ListViewSubItem[])

向集合中添加 ListViewItem.ListViewSubItem 对象的数组。Adds an array of ListViewItem.ListViewSubItem objects to the collection.

AddRange(String[]) AddRange(String[]) AddRange(String[]) AddRange(String[])

基于数组创建新子项,并将其添加到集合中。Creates new subitems based on an array and adds them to the collection.

AddRange(String[], Color, Color, Font) AddRange(String[], Color, Color, Font) AddRange(String[], Color, Color, Font) AddRange(String[], Color, Color, Font)

基于数组创建新子项,并将其添加到具有指定的前景色、背景色和字体的集合中。Creates new subitems based on an array and adds them to the collection with specified foreground color, background color, and font.

Clear() Clear() Clear() Clear()

从集合中移除所有子项和父 ListViewItemRemoves all subitems and the parent ListViewItem from the collection.

Contains(ListViewItem+ListViewSubItem) Contains(ListViewItem+ListViewSubItem) Contains(ListViewItem+ListViewSubItem) Contains(ListViewItem+ListViewSubItem)

确定指定子项是否位于集合中。Determines whether the specified subitem is located in the collection.

ContainsKey(String) ContainsKey(String) ContainsKey(String) ContainsKey(String)

确定集合是否包含具有指定键的项。Determines if the collection contains an item with the specified key.

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

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

返回要用来循环访问子项集合的枚举数。Returns an enumerator to use to iterate through the subitem collection.

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

作为默认哈希函数。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
IndexOf(ListViewItem+ListViewSubItem) IndexOf(ListViewItem+ListViewSubItem) IndexOf(ListViewItem+ListViewSubItem) IndexOf(ListViewItem+ListViewSubItem)

返回指定子项在集合中的索引。Returns the index within the collection of the specified subitem.

IndexOfKey(String) IndexOfKey(String) IndexOfKey(String) IndexOfKey(String)

返回具有指定键的项在集合中的第一个匹配项的索引。Returns the index of the first occurrence of an item with the specified key within the collection.

Insert(Int32, ListViewItem+ListViewSubItem) Insert(Int32, ListViewItem+ListViewSubItem) Insert(Int32, ListViewItem+ListViewSubItem) Insert(Int32, ListViewItem+ListViewSubItem)

将子项插入到集合中的指定索引位置。Inserts a subitem into the collection at the specified index.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(ListViewItem+ListViewSubItem) Remove(ListViewItem+ListViewSubItem) Remove(ListViewItem+ListViewSubItem) Remove(ListViewItem+ListViewSubItem)

从集合中移除指定的项。Removes a specified item from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

移除集合中指定索引处的子项。Removes the subitem at the specified index within the collection.

RemoveByKey(String) RemoveByKey(String) RemoveByKey(String) RemoveByKey(String)

从集合中移除具有指定键的项。Removes an item with the specified key from the collection.

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

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

将项和子项的集合复制到数组中。Copies the item and collection of subitems into an array.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

获取一个值,该值指示对集合的访问是否为同步的(线程安全)。Gets a value indicating whether access to the collection is synchronized (thread safe).

ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

获取可用于同步对集合的访问的对象。Gets an object that can be used to synchronize access to the collection.

IList.Add(Object) IList.Add(Object) IList.Add(Object) IList.Add(Object)

将现有的 ListViewItem.ListViewSubItem 添加到集合中。Adds an existing ListViewItem.ListViewSubItem to the collection.

IList.Contains(Object) IList.Contains(Object) IList.Contains(Object) IList.Contains(Object)

确定指定子项是否位于集合中。Determines whether the specified subitem is located in the collection.

IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object) IList.IndexOf(Object)

返回指定子项在集合中的索引。Returns the index within the collection of the specified subitem.

IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object) IList.Insert(Int32, Object)

将子项插入到集合中的指定索引位置。Inserts a subitem into the collection at the specified index.

IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize IList.IsFixedSize

获取一个值,该值指示集合是否具有固定大小。Gets a value indicating whether the collection has a fixed size.

IList.Item[Int32] IList.Item[Int32] IList.Item[Int32] IList.Item[Int32]

获取或设置集合中指定索引处的 ListViewItem.ListViewSubItemGets or sets the ListViewItem.ListViewSubItem at the specified index within the collection.

IList.Remove(Object) IList.Remove(Object) IList.Remove(Object) IList.Remove(Object)

从集合中移除指定的项。Removes a specified item from the collection.

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

将转换IEnumerableIQueryableConverts an IEnumerable to an IQueryable.

适用于

另请参阅