Delphi 2009+ 的 System.SysUtils提供了一个类似.Net的StringBuilder,用于存储字符数组。 很多人不明白为什么要用TStringBuilder, Delphi中有string,有几乎所有TStringBuilder的功能函数, System.SysUtils中 Read More
posted @ 2019-09-24 17:22 findumars Views(391) Comments(0) Diggs(0) Edit
Delphi自从增强了RTTI后,语言的可灵活性多大增强,Delphi的dbExpress中提供了DBXJSON,和DBXJSONReflect两个单元,可提供JSON序列化 下面的例子是实现Delphi实体对象转换为JSON字符串,以及JSON字符串转换为Delphi 实体对象的示例:(在Delp Read More
posted @ 2019-09-24 17:16 findumars Views(1541) Comments(1) Diggs(0) Edit
Delphi通过inherited 可以调用父类的方法,但是没有提供直接调用父类的父类的方法(爷爷类),通过变通的方式实现如下: 假设父类是TFather,爷爷类TGrand,调用爷爷类的Write方法: 1 2 3 4 5 6 7 8 9 type TWriteProc=procedure of  Read More
posted @ 2019-09-24 17:00 findumars Views(312) Comments(0) Diggs(0) Edit
本文来自:http://www.cnblogs.com/hezihang/p/6083555.html Delphi采用接口方式设计模块,可以降低模块之间的耦合,便于扩展和维护。本文提供一个实现基于接口(IInterface)方式的监听器模式(观察者模式、订阅者模式),实现一个自动多播器。 下面程序 Read More
posted @ 2019-09-24 16:52 findumars Views(468) Comments(0) Diggs(0) Edit
通过TObject.GetInterface可以获得对象的实例实现某个接口,前提条件是必须实例化对象后才能运行GetInterface 下面的方法可获取类是否实现了某个接口,并返回接口的偏移: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Read More
posted @ 2019-09-24 16:51 findumars Views(460) Comments(0) Diggs(0) Edit
以往的Delphi版本,不支持接口的Weak,和UnSafe的引用,支持对象的Weak, UnSafe,而且仅在Android和Ios平台上支持。 现在Delphi XE10.1 Berlin终于增加了对接口的Weak, UnSafe的支持。 1.Weak Weak引用,不影响引用计数器,但是如果对 Read More
posted @ 2019-09-24 16:48 findumars Views(513) Comments(0) Diggs(0) Edit