语言

ListView.ListViewItemCollection.IndexOf(ListViewItem) 方法

定义

返回指定项集合中的索引。

public:
 int IndexOf(System::Windows::Forms::ListViewItem ^ item);
public int IndexOf(System.Windows.Forms.ListViewItem item);
member this.IndexOf : System.Windows.Forms.ListViewItem -> int
Public Function IndexOf (item As ListViewItem) As Integer

参数

item
ListViewItem

一个 ListViewItem 表示在集合中查找的项。

返回

集合中项位置的从零开始的索引;否则,如果项不在集合中,则 -1。

注解

使用 IndexOf 此方法可以确定项在集合中的位置。 若要在调用此方法之前确定集合中是否包含项,请使用该方法 Contains 。

适用于

另请参阅