Searches the one-dimensional Array for a specific value, starting at the specified index and ending at the last element.
[Visual Basic] Overloads Public Shared Function IndexOf( _ ByVal array As Array, _ ByVal value As Object, _ ByVal startIndex As Integer _ ) As Integer [C#] public static int IndexOf( Array array, object value, int startIndex ); [C++] public: static int IndexOf( Array* array, Object* value, int startIndex ); [JScript] public static function IndexOf( array : Array, value : Object, startIndex : int ) : int;
The index of the first occurrence of value in the range startIndex through the last element, or-1 if value does not occur in that range.
Exception Type | Condition |
---|---|
ArgumentNullException | array is a null reference (in Visual Basic Nothing). |
ArgumentOutOfRangeException | startIndex is outside the range of valid indices for array. |
The Array is searched forwards, starting at startIndex and ending at the last element, and the elements are compared to the specified value using the Equals method.
Array Class | Array Members | System Namespace | Array.IndexOf Overload List | LastIndexOf