ListBox.ObjectCollection.IndexOf(Object) ListBox.ObjectCollection.IndexOf(Object) ListBox.ObjectCollection.IndexOf(Object) ListBox.ObjectCollection.IndexOf(Object) Method

定義

傳回指定項目集合中的索引。Returns the index within the collection of the specified item.

public:
 virtual int IndexOf(System::Object ^ value);
public int IndexOf (object value);
abstract member IndexOf : obj -> int
override this.IndexOf : obj -> int
Public Function IndexOf (value As Object) As Integer

參數

value
Object Object Object Object

表示位於集合中項目的物件。An object representing the item to locate in the collection.

傳回

以零起始的索引,是集合中項目的位置,否則為負一 (-1)。The zero-based index where the item is located within the collection; otherwise, negative one (-1).

實作

例外狀況

value 參數為 null。The value parameter is null.

備註

IndexOf方法可讓您判斷項目位於集合。The IndexOf method enables you to determine where an item is located within the collection. 若要判斷項目是否位於集合呼叫此方法之前,請使用Contains方法。To determine whether an item is located within the collection before calling this method, use the Contains method.

適用於

另請參閱