GetKey(Index: Integer): Variant;
Index - index of the element, which key should be obtained.
The GetKey method returns key of the element, which index is passed by the Index parameter.
Sub Main;
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 Main;
After executing the example the "v" variable contains the key of the first element of the array.
See also: