ReadOnlyCollection<T>.IList.IndexOf(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
決定特定項目的 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 索引;否則,為 -1。
實作
例外狀況
value 並非一般型態參數 T所指定的型態。
備註
此方法利用預設比較器 EqualityComparer<T>.Default來判定等式。
此方法執行線性搜尋;因此,此方法是一個 O(n) 運算,其中 n 為 Count。
此成員為明確介面成員實作。 它只能在實 ReadOnlyCollection<T> 例投射到 IList 介面時使用。