SetByIndex(Index: Integer; Value: Variant);
Index. Index of the element, which value should be changed.
Value. New element value that should be set.
The SetByIndex method changes element value.
Sub UserProc;
Var
SortList: ISortedList;
i: Integer;
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;
SortList.SetByIndex(SortList.Count - 1, "Last Element");
End Sub UserProc;
After executing the example the value of the last element is modified.
See also: