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