ListView.ListViewItemCollection.Contains(ListViewItem) ListView.ListViewItemCollection.Contains(ListViewItem) ListView.ListViewItemCollection.Contains(ListViewItem) ListView.ListViewItemCollection.Contains(ListViewItem) Method

定义

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

public:
 bool Contains(System::Windows::Forms::ListViewItem ^ item);
public bool Contains (System.Windows.Forms.ListViewItem item);
member this.Contains : System.Windows.Forms.ListViewItem -> bool
Public Function Contains (item As ListViewItem) As Boolean

参数

item
ListViewItem ListViewItem ListViewItem ListViewItem

ListViewItem,表示要在集合中查找的项。A ListViewItem representing the item to locate in the collection.

返回

如果集合中包含该项,则为 true;否则为 falsetrue if the item is contained in the collection; otherwise, false.

注解

使用Contains方法可以确定ListViewItem是否为集合的成员。The Contains method enables you to determine whether a ListViewItem is a member of the collection. 一旦您知道该项位于集合中,就可以使用IndexOf方法来确定项在集合中的位置。Once you know that the item is in the collection, you can use the IndexOf method to determine the position of the item in the collection.

适用于

另请参阅