ContainsKey(Key: Variant): Boolean;
Key. Key of the element, which presence should be checked.
The ContainsKey method checks if there is an element with the specified key.
Sub UserProc;
Var
SortList: ISortedList;
i: Integer;
s: String;
Begin
SortList := New SortedList.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
SortList.Add("Key_" + Math.RandBetweenI(0, 100).ToString, "Number " + Math.RandBetweenI(0, 100).ToString);
End For;
If SortList.ContainsKey("Key_25") Then
s := "Yes";
Else
s := "No";
End If;
End Sub UserProc
After executing the example the "s" variable is set to Yes, if the generated sorted array contains an element with the Key_25 key.
See also: