Searches a section of the ArrayList for the specified Object and returns the index of the first occurrence.
[Visual Basic] Overloads Overridable Public Function IndexOf( _ ByVal value As Object, _ ByVal startIndex As Integer, _ ByVal endIndex As Integer _ ) As Integer [C#] public virtual int IndexOf( object value, int startIndex, int endIndex ); [C++] public: virtual int IndexOf( Object* value, int startIndex, int endIndex ); [JScript] public function IndexOf( value : Object, startIndex : int, endIndex : int ) : int;
The index of the first occurrence of value in the ArrayList within the range startIndex through endIndex-1, if found; otherwise,-1.
Exception Type | Condition |
---|---|
ArgumentException | startIndex is less than zero.
-or- startIndex is equal to or greater than Count. -or- endIndex is less than zero. -or- endIndex is greater than Count. |
This method can be overridden by a derived class.
The ArrayList is searched forwards starting at startIndex and ending at endIndex less one.
ArrayList Class | ArrayList Members | System.Collections Namespace | ArrayList.IndexOf Overload List | LastIndexOf