havrlisan 33 Posted Thursday at 10:51 AM Is it possible to know if a property is redeclared in a class or skip the original property entirely (the redeclared property would overwrite the original property in the Rtti)? It's easier to explain through an example: TMyClass = class strict private FInt: Integer; public property Int: Integer read FInt write FInt; end; TMyChild = class(TMyClass) published [RandomAttr] property Int; end; The Rtti will return 2 properties for TMyChild class, even though both have the same name. I haven't found any data in the TRttiProperty that would indicate that the property is redeclared. Second question would be, if this is not possible: can I rely on the returned properties to be sorted by class inheritance? In other words, can I safely assume the returned array of properties would first contain properties of TMyChild, and then of TMyClass? Share this post Link to post
havrlisan 33 Posted Thursday at 10:55 AM 2 minutes ago, havrlisan said: Second question would be, if this is not possible: can I rely on the returned properties to be sorted by class inheritance? In other words, can I safely assume the returned array of properties would first contain properties of TMyChild, and then of TMyClass? Should've searched at least a bit before asking this question.. Digging into TRttiType.GetProperties I found the method TRttiTypeHelper.GetObjectListInVisOrder, which does exactly what I'm asking here. Original question still stands, although knowing this is enough to handle my scenario. Share this post Link to post