IList.Contains

Syntax

Contains(Value: Variant): Boolean;

Parameters

Value is an element value, which existence should be checked.

Description

The Contains method checks if the element with the Value value exists.

Example

Sub Main;

Var

ArrayL: IArrayList;

List: IList;

i: Integer;

s: String;

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;

If List.Contains(50) Then

s:="Yes";

Else

s:="No";

End If;

End Sub Main;

After executing the example a dynamic array with random values is created. The "s" variable contains Yes if the element with the 50 value exists in the array.

See also:

IList