ImmutableList.LastIndexOf 方法

定义

重载

LastIndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

LastIndexOf<T>(IImmutableList<T>, T)

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

类型参数

T

列表中项的类型。The type of items in the list.

参数

list
IImmutableList<T>

要搜索的列表。The list to search.

item
T

要在不可变列表中查找的对象。The object to locate in the Immutable list. 对于引用类型,该值可以为 null。The value can be null for reference types.

返回

如果找到,则为整个不可变列表中项的最后一个匹配项的从零开始的索引;否则为 -1。The zero-based index of the last occurrence of item within the entire the Immutable list, if found; otherwise, -1.

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

搜索指定的对象,并返回整个不可变列表中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the entire immutable list.

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

类型参数

T

列表中项的类型。The type of items in the list.

参数

list
IImmutableList<T>

要搜索的列表。The list to search.

item
T

要在不可变列表中查找的对象。The object to locate in the Immutable list. 对于引用类型,该值可以为 null。The value can be null for reference types.

equalityComparer
IEqualityComparer<T>

要在搜索中使用的相等性比较器。The equality comparer to use in the search.

返回

如果找到,则为整个不可变列表中项的最后一个匹配项的从零开始的索引;否则为 -1。The zero-based index of the last occurrence of item within the entire the Immutable list, if found; otherwise, -1.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

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

类型参数

T

列表中项的类型。The type of items in the list.

参数

list
IImmutableList<T>

要搜索的列表。The list to search.

item
T

要在不可变列表中查找的对象。The object to locate in the Immutable list. 对于引用类型,该值可以为 null。The value can be null for reference types.

startIndex
Int32

向后搜索的从零开始的起始索引。The zero-based starting index of the backward search.

返回

如果在不可变列表中从第一个元素到索引的元素范围内找到项的最后一个匹配项,则为该项的从零开始的索引;否则为 -1。The zero-based index of the last occurrence of item within the range of elements in the Immutable list that extends from the first element to index, if found; otherwise, -1.

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

搜索指定对象并返回不可变列表中从第一个元素到指定索引这部分元素中最后一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the immutable list that extends from the first element to the specified index.

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

类型参数

T

列表中项的类型。The type of items in the list.

参数

list
IImmutableList<T>

要搜索的列表。The list to search.

item
T

要在不可变列表中查找的对象。The object to locate in the Immutable list. 对于引用类型,该值可以为 null。The value can be null for reference types.

startIndex
Int32

向后搜索的从零开始的起始索引。The zero-based starting index of the backward search.

count
Int32

要搜索的部分中的元素数。The number of elements in the section to search.

返回

如果在不可变列表中从第一个元素到索引的元素范围内找到项的最后一个匹配项,则为该项的从零开始的索引;否则为 -1。The zero-based index of the last occurrence of item within the range of elements in the Immutable list that extends from the first element to index, if found; otherwise, -1.

适用于