IndexOf(Value: Variant): Integer;
Value - list element value that should be found.
The IndexOf method searches for the Value value and returns index in the list if the search is successful, otherwise it returns -1.
Sub Main;
Var
ArrayL: IArrayList;
List: IList;
i: Integer;
Begin
ArrayL:=New ArrayList.Create;
List:=ArrayL As IList;
For i:=0 To Math.RandBetweenI(0,100) Do
List.Add(Math.RandBetweenI(0,100));
End For;
i:=List.IndexOf(50);
End Sub Main;
After executing the example a dynamic array with random values is created, the element with the 50 value is searched, and in case of successful search the "i" variable contains index of this element.
See also: