本文介绍了是否有Delphi对象序列化库支持泛型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道的所有开源对象序列化库(JvAppStorage,NativeXml,OmniXML,SuperObject,lkJSON)似乎都不支持泛型属性。 (如果我错了,请更正我)。你知道有这个功能或计划添加的图书馆吗? Delphi 2010中的JSON序列化库(我仍在使用Delphi 2009)如何实现
示例
...
发布
属性Prop1:TObjectList< TMyPersistent>读取GetProp1写入SetProp1;
...
解决方案
我在这篇文章中使用 JCL / JVCL序列化器的简单解决方案:
All open source object serialization libraries which I know of (JvAppStorage, NativeXml, OmniXML, SuperObject, lkJSON) seem to have no support for Generics properties yet. (Please correct me if I am wrong).
Do you know a library which has this feature or plans to add it? How about the JSON serialization library in Delphi 2010 (I am still using Delphi 2009)
Example
...
published
property Prop1: TObjectList<TMyPersistent> read GetProp1 write SetProp1;
...
解决方案
Have a look to my simple solution using JCL/JVCL serializer in this post:
How to serialize Delphi TObjectList<TMyClass> type to XML with TJvAppXMLFileStorage?
这篇关于是否有Delphi对象序列化库支持泛型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!