Replacement for TStringList in Delphi Prism.

天大地大妈咪最大 提交于 2019-12-12 11:23:35

问题


I am migrating an application written in Delphi 2007 .Net to Delphi Prism, which is the best option to replace the TStringList and TStrings class?

Thanks in advance.

Bye.


回答1:


Just use the built in List types in the .NET framework, or the StringCollection.

The easiest are the generic lists:

List<String>

But StringCollection has a few bits that the List does not have; you can read a bit about that in this thread.

The advantage of using built-in .NET Framework classes, is that there is plenty documentation at MSDN, have loads of examples (for instance atCodeProject), and usually support more features (like implementing required interfaces to do data binding and such: the TStringList in ShineOn does not do that).

The advantage of using VCL like things is that you are more familiar with the VCL so it gets you started quicker. But there is a reason why VCL.NET has not been developed further...

Janka Janos has a great comparison chart of features in C# and Delphi Prism. That will help you translate C# examples into Delphi Prism code.

--jeroen




回答2:


Have you looked at ShineOn? It has a Classes.pas with TStringList in it.




回答3:


I have used Collections.Specialized.HybridDictionary (and similar) classes in the little bit of C# I have done. As it is a standard .net object it should be available in Prism.

I don't know if it has a LoadFrom/Save to file though



来源:https://stackoverflow.com/questions/1382395/replacement-for-tstringlist-in-delphi-prism

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!