如何使用RTTI访问Delphi数组属性 [英] How do I access Delphi Array Properties using RTTI

查看:54
本文介绍了如何使用RTTI访问Delphi数组属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉使用Delphi RTTI来访问简单属性(整数/枚举/字符串等),但是我无法掌握如何使用数组属性。

I'm familiar with using Delphi RTTI to access "simple" properties (ints/enums/strings, etc) but I cannot grasp how to work with Array properties.

我首先要查找GetPropValue / SetPropValue调用的数组等效项。我希望看到与它们类似的东西,但是要使用额外的 index参数,但似乎不能在typinfo单元帮助中找到任何内容。

I'm starting by looking for array equivalents for the GetPropValue/SetPropValue calls. I'd expect to see similar ones to these, but taking an extra "index" parameter, but can't seem to find anything in the typinfo unit help.

推荐答案

在D2009之前,数组和数组属性无法使用RTTI。但是当巴里·凯利(Barry Kelly)在Delphi Live会议上谈到计划在D2010上使用的增强型RTTI系统时,他提到,包括阵列在内的所有产品都将提供RTTI。因此,这是一个值得期待的功能...

Arrays and array properties can't have RTTI for them up to D2009. But when Barry Kelly spoke at the Delphi Live conference about an enhanced RTTI system that's planned for D2010, he mentioned that everything, including arrays, would have RTTI available. So this is a feature to look forward to...

这篇关于如何使用RTTI访问Delphi数组属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆