Collection<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 是一个无法赋值给 IList 的类型。

注解

此方法使用默认比较器 Comparer<T>.Default确定相等性。 Comparer<T>.Default 检查类型 T 是否实现 System.IComparable<T> 和使用该实现(如果可用)。 否则, Comparer<T>.Default 检查类型 T 是否实现 System.IComparable。 如果类型 T 未实现任一接口,则此方法使用 Object.Equals

此方法是一n个 O () 操作,其中nCount

适用于