I have a class:
TData = class
public
id: largeint;
name: String;
constructor Create(aID: Integer; const aName: String);
end;
I want to run a loop (or other action) in order to get fields ID and NAME of the above class. Also I have record:
DataRecord=record
id:largeint;
name:string;
end;
DataType=array of DataRecord;
In loop I want automatically assign class property to record property, like id=id, name=name.
e.g function:
for i:=0 to dataClass.fieldscount do
record[prop]=dataClass[prop]
result:=record;
So value in class.id should be written to record.id and value in class.name have to be written to record.name.
I know I can manualy assign class.id=record.id, but I want that program itself have to find names (in class and record they are identical).
Is it possible in some way? Thanks.