Determines the index of the last occurrence of a value in the one-dimensional Array by searching backwards, starting and ending at the specified indices.
[Visual Basic] Overloads Public Shared Function LastIndexOf( _ ByVal array As Array, _ ByVal value As Object, _ ByVal startIndex As Integer, _ ByVal endIndex As Integer _ ) As Integer [C#] public static int LastIndexOf( Array array, object value, int startIndex, int endIndex ); [C++] public: static int LastIndexOf( Array* array, Object* value, int startIndex, int endIndex ); [JScript] public static function LastIndexOf( array : Array, value : Object, startIndex : int, endIndex : int ) : int;
The index of the last occurrence of value in the range endIndex through startIndex, 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 or endIndex is outside the range of valid indices for array.
-or- endIndex is greater than startIndex. |
The Array is searched backwards, starting at startIndex and ending at endIndex, and the elements are compared to the specified value using the Equals method.
Array Class | Array Members | System Namespace | Array.LastIndexOf Overload List | IndexOf