ImmutableList.IndexOf 方法
定义
重载
| IndexOf<T>(IImmutableList<T>, T, Int32) |
搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element. |
| IndexOf<T>(IImmutableList<T>, T, Int32, Int32) |
搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element. |
| IndexOf<T>(IImmutableList<T>, T) |
搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list. |
| IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>) |
搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list. |
IndexOf<T>(IImmutableList<T>, T, Int32)
搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.
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
列表中项的类型。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 search. 空列表中 0(零)为有效值。0 (zero) is valid in an empty list.
返回
如果在不可变列表中从索引到最后一个元素的元素范围内找到第一个匹配项,则为该项的从零开始的索引;否则为 -1。The zero-based index of the first occurrence of item within the range of elements in the Immutable list that extends from index to the last element, if found; otherwise, -1.
适用于
IndexOf<T>(IImmutableList<T>, T, Int32, Int32)
搜索指定对象并返回不可变列表中从指定索引到最后一个元素这部分元素中第一个匹配项的从零开始索引。Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the immutable list that extends from the specified index to the last element.
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
列表中项的类型。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 search. 空列表中 0(零)为有效值。0 (zero) is valid in an empty list.
- count
- Int32
要搜索的部分中的元素数。The number of elements in the section to search.
返回
如果在不可变列表中从索引到最后一个元素的元素范围内找到第一个匹配项,则为该项的从零开始的索引;否则为 -1。The zero-based index of the first occurrence of item within the range of elements in the Immutable list that extends from index to the last element, if found; otherwise, -1.
适用于
IndexOf<T>(IImmutableList<T>, T)
搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.
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
列表中项的类型。The type of items in the list.
参数
- list
- IImmutableList<T>
要搜索的列表。The list to search.
- item
- T
要在列表中查找的对象。The object to locate in the list. 对于引用类型,该值可以为 null。The value can be null for reference types.
返回
如果在列表中从索引到最后一个元素的元素范围内找到项的第一个匹配项,则为该项的从零开始的索引;否则为 -1。The zero-based index of the first occurrence of item within the range of elements in the list that extends from index to the last element, if found; otherwise, -1.
适用于
IndexOf<T>(IImmutableList<T>, T, IEqualityComparer<T>)
搜索指定的对象,并返回列表中第一个匹配项的从零开始的索引。Searches for the specified object and returns the zero-based index of the first occurrence within the list.
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
列表中项的类型。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 first occurrence of item within the range of elements in the immutable list that extends from index to the last element, if found; otherwise, -1.