GetKey(Index: Integer): Variant;
Index. Index of the element, which key should be obtained.
The GetKey method returns key of the element with the specified index.
Sub UserProc;
Var
SortList: ISortedList;
i: Integer;
v: Variant;
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;
v := SortList.GetKey(0);
End Sub UserProc;
After executing the example the "v" variable contains the key of the first element of the array.
See also: