实际使用德尔福的新型RTTI - 属性,价值 [英] Practical usage for Delphi's new RTTI - Attributes,Values

查看:152
本文介绍了实际使用德尔福的新型RTTI - 属性,价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现了一个很好的解释新RTTI Delphi中,但我不明白一件重要的事情所有我已阅读 - 我在哪里可以使用

I found a great explanation about the new RTTI in Delphi,but I don't understand one important thing about all I have read - Where can I use that?

什么是它应该更换?

推荐答案

扩展的RTTI就像在.NET中的反思。通过它可以访问到你的应用程序内部结构的信息。您可以在运行时访问类的属性,方法等,在某种程度上你不能前操作。

The extended RTTI works like Reflection in .NET. It gives you access to your internal application structure information. You can access class properties, methods etc.. at runtime, at extent you could not do it before.

使用它的一些方式:


  1. 序列化/反序列化的类XML或其它媒体

  2. 对象数据库的映射。 ORM。

  3. 对象的克隆

  4. 方法动态调用

  5. 在运行时对象的扫描和代理根据这一点。

  6. 的插件易开发型系统

有可能是一个很大的情景,其中,将是有益的使用。简而言之,增加了动态方面,您的应用程序。你的产品是能够在运行时做一些事情,更有效,比在设计时设计的一切。它不是灵丹妙药,很多人可能永远不会使用它。但是一些设计模式还是有些问题就不能得到解决(至少不能有效的方式),而使用新的RTTI

There is probably a lot of scenarios where it would be beneficial to use it. In short it adds dynamic aspect to your application. Your product is able to do some things at runtime, and more efficiently, than designing everything at designtime. It is not a silver bullet and a lot of people may never use it. But some design patterns or some problems just cannot be solved (at least not in efficient way) without the use of the new RTTI

这篇关于实际使用德尔福的新型RTTI - 属性,价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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