AFAIK, we cannot assign direct values ββto record elements if the specified record is in the general structure.
For example, having:
type TMyRec = record Width: integer; Height: integer; end; var myList: TList<TMyRec>; ... myList[888].Width:=1000; //ERROR here: Left side cannot be assigned. ...
So far, I have used a temporary variable to overcome this:
var ... temp: TMyRec; ... begin ... temp:=myList[999]; temp.Width:=1000; myList[999]:=temp; ... end;
Ugly, slow but working. But now I want to add a dynamic array to TMyRec :
type TMyRec = record Width: integer; Height: integer; Points: array or TPoint; end;
... or any other data structure that can become large, so copying back and forth into a temporary variable is not an option.
The question arises: how to change a member of a record when this record is in the general structure without the need to copy it in a temporary var?
TIA for your feedback
source share