IDictionary.Contains

Syntax

Contains(Key: Variant): Boolean;

Parameters

Key - element key.

Description

The Contains method checks if the element with the Key key exists.

Example

Sub Main;

Var

Hast: IHashtable;

Dict: IDictionary;

i: Integer;

s: String;

Begin

Hast:=New Hashtable.Create;

Dict:=Hast As IDictionary;

For i:=0 To 100 Do

Dict.Add(Math.RandBetweenI(0,100),Math.RandBetween(0,100));

End For;

If Dict.Contains(10) Then

s:="Yes";

Else

s:="No";

End If;

End Sub Main;

After executing the example a glossary that contains random numbers from 0 to 100 is created. Each element will have random key. The "s" variable contains Yes if element with the 10 key exists in the glossary.

See also:

IDictionary