IListContract<T>.IndexOf(T) Method

Definition

Returns the index of a specific item in an IListContract<C> collection.

public:
 int IndexOf(T item);
public int IndexOf (T item);
abstract member IndexOf : 'T -> int
Public Function IndexOf (item As T) As Integer

Parameters

item
T

An item in the collection.

Returns

The index of the specified item.

Exceptions

index is less than zero.

-or-

index is equal to or greater than the return value of the GetCount() method.

Remarks

If there are several objects of the same type in the collection, this method identifies the index of the item that is the first occurrence of the specified type in the collection.

The GetItem method does not remove the item at the specified index. To remove an item from the IListContract<T> collection, use the RemoveAt method.

Applies to