IDictionary.Contains

Syntax

Contains(Key: Variant): Boolean;

Parameters

Key. Element key.

Description

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

Comments

The method returns True if the element with the specified key is in the dictionary, and False if the element is missing.

Example

Sub Main;
Var
    Hast: IHashtable;
    i: Integer;
    s: String;
Begin
    Hast := New Hashtable.Create;
    For i := 0 To 100 Do
        Hast.Add(Math.RandBetweenI(0100), Math.RandBetween(0100));
    End For;
    If Hast.Contains(10Then
        s := "Yes";
    Else
        s := "No";
    End If;
End Sub Main;

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

See also:

IDictionary