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

要在 Object 中定位的 IList

返回

Int32

如果在列表中找到,则为 value 的索引;否则为 -1。

实现

例外

value 所属的类型不是泛型类型参数 T 的指定类型。

注解

此方法使用默认比较器 EqualityComparer<T>.Default确定相等性。

此方法执行线性搜索;因此,此方法是 O () n 操作,其中nCount

此成员是显式接口成员的实现。 它只能在 ReadOnlyCollection<T> 实例被强制转换为 IList 接口时使用。

适用于