How do I enumerate all properties in an object and obtain their values?

后端 未结 3 1751
醉酒成梦
醉酒成梦 2021-01-05 09:56

I want to enumerate all properties: private, protected, public etc. I wish to use the built in facilities and not use any third party code.

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-05 10:21

    Here is an excellent starting point using advanced capabilities of recent Delphi version:

    • Rtti Explorer Lite by RRUZ.

    The following link rather targets early version (from D5 on). Based on the unit TypInfo.pas, it's limited but still instructive:

    • RTTI Explorer v.1.1 by Niek Sluyter.

提交回复
热议问题