Bewerken

Share via


ImmutableList<T>.IndexOf Method

Definition

Overloads

IndexOf(T)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire immutable list.

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

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.

IndexOf(T)

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

Searches for the specified object and returns the zero-based index of the first occurrence within the entire immutable list.

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

Parameters

value
T

The object to locate in the immutable list. The value can be null for reference types.

Returns

The zero-based index of the first occurrence of value within the entire immutable list, if found; otherwise, ?1.

Implements

Applies to

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

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

Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the list that starts at the specified index and contains the specified number of elements.

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

Parameters

item
T

The object to locate in the list The value can be null for reference types.

index
Int32

The zero-based starting index of the search. 0 (zero) is valid in an empty list.

count
Int32

The number of elements in the section to search.

equalityComparer
IEqualityComparer<T>

The equality comparer to use in the search.

Returns

The zero-based index of the first occurrence of item within the range of elements in the list that starts at index and contains count number of elements, if found; otherwise, -1.

Implements

Applies to