Ryan Joseph
2018-07-09 16:22:39 UTC
Could I do some RTL magic on a record to loop over its fields and set them to another record by name? In the example below I want to set all the fields in TRecA to matching named fields in TRecB. Just curious if we can do this automatically using RTL.
type
TRecA = record
a: string;
b: string;
end;
type
TRecB = record
a: string;
b: string;
c: integer;
d: integer;
end;
for field in recA.GetFields do
recB.GetFieldByName(field.name).value := field.value
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal
type
TRecA = record
a: string;
b: string;
end;
type
TRecB = record
a: string;
b: string;
c: integer;
d: integer;
end;
for field in recA.GetFields do
recB.GetFieldByName(field.name).value := field.value
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal