IListContract<T>.IndexOf(T) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.