Table of Contents

Method GetItemIndex

Namespace
Alternet.Base.Collections
Assembly
Alternet.UI.Common.dll

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

item T

The item to search for in the collection.

throwException bool

true to throw an exception if the item specified in the item parameter 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 item is not in the collection, and the throwException parameter value is true.