ReadOnlyCollection<T>.IList.IndexOf(Object) 方法

定義

判斷 IList 中指定項目的索引。

 virtual int System.Collections.IList.IndexOf(System::Object ^ value) = System::Collections::IList::IndexOf;
int IList.IndexOf (object value);
abstract member System.Collections.IList.IndexOf : obj -> int
override this.System.Collections.IList.IndexOf : obj -> int
Function IndexOf (value As Object) As Integer Implements IList.IndexOf

參數

value
Object

要在 IList 中尋找的 Object

傳回

如果可在清單中找到則為 value 的索引,否則為 -1。

實作

例外狀況

value 之型別不是為泛型型別參數 T 所指定的型別。

備註

這個方法會使用預設比較子 EqualityComparer<T>.Default來判斷相等。

這個方法會執行線性搜尋;因此,這個方法是 O (n) 作業,其中 nCount

這個成員是明確介面成員實作, 只有在 ReadOnlyCollection<T> 執行個體轉換成 IList 介面時,才能使用這個成員。

適用於