Method GetItemIndex
GetItemIndex(T, bool)
Retrieves the index of the specified item within the collection, and optionally raises an exception if the specified item is not within the collection.
public virtual int GetItemIndex(T item, bool throwException = true)
Parameters
itemTThe item to search for in the collection.
throwExceptionbooltrue to throw an exception if the item specified in the
itemparameter is not a item in the collection; otherwise, false.
Returns
- int
A zero-based index value that represents the location of the specified item within the collection; otherwise -1 if the specified item is not found in the collection.
Exceptions
- ArgumentException
The
itemis not in the collection, and thethrowExceptionparameter value is true.