TRttiProperty map for class definition equivalent
I am wondering if it is possible to reference the class definition directly for the purpose of using it in conjunction with RTTI (map property to TRttiProperty, etc.).
eg.
I would like to use TMyClass.MyProperty as TRttiProperty without having to resolve it with name / string, this will preserve the integrity of the code and compiler since string variables can be misspelled etc.
thank
+3
source to share
1 answer
Assuming you want to do something like this
P:=TRttiProperty(TMyClass.MyProperty);
or write a function like this
function GetPropertyInfo(P: reference to property):TRttiProperty;
This is not possible, for this you will need which delphi supports property references. Therefore, the only way to access (reference) a class property is to use its name through a string.
+5
source to share