ImmutableList.IndexOf 方法

定义

重载

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。

IndexOf<T>(IImmutableList<T>, T)

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

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

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

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static int IndexOf(System::Collections::Immutable::IImmutableList<T> ^ list, T item, int startIndex);
public static int IndexOf<T> (this System.Collections.Immutable.IImmutableList<T> list, T item, int startIndex);
static member IndexOf : System.Collections.Immutable.IImmutableList<'T> * 'T * int -> int
<Extension()>
Public Function IndexOf(Of T) (list As IImmutableList(Of T), item As T, startIndex As Integer) As Integer

类型参数

T

列表中项的类型。

参数

list
IImmutableList<T>

要搜索的列表。

item
T

要在不可变列表中查找的对象。 对于引用类型,该值可以为 null。

startIndex
Int32

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

返回

Int32

如果在不可变列表中从索引到最后一个元素的元素范围内找到第一个匹配项,则为该项的从零开始的索引;否则为 -1。

适用于

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

搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static int IndexOf(System::Collections::Immutable::IImmutableList<T> ^ list, T item, int startIndex, int count);
public static int IndexOf<T> (this System.Collections.Immutable.IImmutableList<T> list, T item, int startIndex, int count);
static member IndexOf : System.Collections.Immutable.IImmutableList<'T> * 'T * int * int -> int
<Extension()>
Public Function IndexOf(Of T) (list As IImmutableList(Of T), item As T, startIndex As Integer, count As Integer) As Integer

类型参数

T

列表中项的类型。

参数

list
IImmutableList<T>

要搜索的列表。

item
T

要在不可变列表中查找的对象。 对于引用类型,该值可以为 null。

startIndex
Int32

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

count
Int32

要搜索的部分中的元素数。

返回

Int32

如果在不可变列表中从索引到最后一个元素的元素范围内找到第一个匹配项,则为该项的从零开始的索引;否则为 -1。

适用于

IndexOf<T>(IImmutableList<T>, T)

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

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static int IndexOf(System::Collections::Immutable::IImmutableList<T> ^ list, T item);
public static int IndexOf<T> (this System.Collections.Immutable.IImmutableList<T> list, T item);
static member IndexOf : System.Collections.Immutable.IImmutableList<'T> * 'T -> int
<Extension()>
Public Function IndexOf(Of T) (list As IImmutableList(Of T), item As T) As Integer

类型参数

T

列表中项的类型。

参数

list
IImmutableList<T>

要搜索的列表。

item
T

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

返回

Int32

如果在列表中从索引到最后一个元素的元素范围内找到项的第一个匹配项,则为该项的从零开始的索引;否则为 -1。

适用于

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

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

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static int IndexOf(System::Collections::Immutable::IImmutableList<T> ^ list, T item, System::Collections::Generic::IEqualityComparer<T> ^ equalityComparer);
public static int IndexOf<T> (this System.Collections.Immutable.IImmutableList<T> list, T item, System.Collections.Generic.IEqualityComparer<T> equalityComparer);
public static int IndexOf<T> (this System.Collections.Immutable.IImmutableList<T> list, T item, System.Collections.Generic.IEqualityComparer<T>? equalityComparer);
static member IndexOf : System.Collections.Immutable.IImmutableList<'T> * 'T * System.Collections.Generic.IEqualityComparer<'T> -> int
<Extension()>
Public Function IndexOf(Of T) (list As IImmutableList(Of T), item As T, equalityComparer As IEqualityComparer(Of T)) As Integer

类型参数

T

列表中项的类型。

参数

list
IImmutableList<T>

要搜索的列表。

item
T

要在不可变列表中查找的对象。 对于引用类型,该值可以为 null。

equalityComparer
IEqualityComparer<T>

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

返回

Int32

如果在不可变列表中从索引到最后一个元素的元素范围内找到第一个匹配项,则为该项的从零开始的索引;否则为 -1。

适用于