Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Verständnisfrage zu TValue (https://www.delphipraxis.net/203604-verstaendnisfrage-zu-tvalue.html)

Stevie 5. Mär 2020 09:53

AW: Verständnisfrage zu TValue
 
Delphi-Quellcode:
function RestoreProperty(aInstance: TObject; const aPropertyName: string; const aValue: TValue): Boolean;
var
  prop: TRttiProperty;
begin
  prop := TType.GetType(aInstance.ClassType).GetProperty(aPropertyName);
  prop.SetValue(aInstance, aValue.Convert(prop.PropertyType.Handle));
end;

TigerLilly 5. Mär 2020 10:21

AW: Verständnisfrage zu TValue
 
Danke! Sehr cool.


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:55 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz