语言

ImmutableList<T>.IndexOf 方法

定义

重载

名称 说明
IndexOf(T)

搜索指定的对象,并返回整个不可变列表中第一个匹配项的从零开始的索引。

IndexOf(T, Int32, Int32, IEqualityComparer<T>)

搜索指定的对象,并返回列表中从指定索引开始且包含指定数量的元素的第一个匹配项的从零开始的索引。

IndexOf(T)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

搜索指定的对象,并返回整个不可变列表中第一个匹配项的从零开始的索引。

public:
 virtual int IndexOf(T value);
public int IndexOf(T value);
abstract member IndexOf : 'T -> int
override this.IndexOf : 'T -> int
Public Function IndexOf (value As T) As Integer

参数

value
T

要定位在不可变列表中的对象。 该值可以 null 用于引用类型。

返回

如果找到,则为整个不可变列表中第一个匹配项 value 的从零开始的索引;否则为 ?1。

实现

适用于

IndexOf(T, Int32, Int32, IEqualityComparer<T>)

Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs
Source:
ImmutableList_1.cs

搜索指定的对象,并返回列表中从指定索引开始且包含指定数量的元素的第一个匹配项的从零开始的索引。

public:
 virtual int IndexOf(T item, int index, int count, System::Collections::Generic::IEqualityComparer<T> ^ equalityComparer);
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T> equalityComparer);
public int IndexOf(T item, int index, int count, System.Collections.Generic.IEqualityComparer<T>? equalityComparer);
abstract member IndexOf : 'T * int * int * System.Collections.Generic.IEqualityComparer<'T> -> int
override this.IndexOf : 'T * int * int * System.Collections.Generic.IEqualityComparer<'T> -> int
Public Function IndexOf (item As T, index As Integer, count As Integer, equalityComparer As IEqualityComparer(Of T)) As Integer

参数

item
T

要在列表中查找的对象:值可以为引用类型为 null。

index
Int32

从零开始的搜索索引。 0 (零)在空列表中有效。

count
Int32

要搜索的节中的元素数。

equalityComparer
IEqualityComparer<T>

在搜索中使用的相等比较器。

返回

列表中从索引开始且包含元素计数(如果找到)的项范围内的项的第一个匹配项的从零开始的索引;否则为 -1。

实现

适用于