Einzelnen Beitrag anzeigen

TigerLilly

Registriert seit: 24. Mai 2017
Ort: Wien, Österreich
1.176 Beiträge
 
Delphi 11 Alexandria
 
#10

AW: Verständnisfrage zu TValue

  Alt 4. Mär 2020, 20:22
Delphi-Quellcode:
  props := TType.GetType(TMyObject).GetDeclaredProperties;
...
  for i := 0 to High(props) do
    props[i].SetValue(m, TValue.From(values[i]).Convert(props[i].PropertyType.Handle, ISO8601FormatSettings));

end.
Ich kanns nicht umsetzen:
Ich habe
Code:
function RestoreProperty(aInstance: TObject; aPropertyName: string; Value:TValue): Boolean;
Wie müsste das weiter gehen?
Code:
var
  prop: TRttiProperty;
begin
  prop := TType.GetType(?);
  prop.SetValue(? , TValue.From(value).Convert(prop.PropertyType.Handle));
  Mit Zitat antworten Zitat