Delphi Prism 中 TStringList 的替代品。
我正在将用 Delphi 2007 .Net 编写的应用程序迁移到 Delphi Prism,哪个是替换 TStringList 和 TStrings 类的最佳选择?
提前致谢。
再见。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需使用 .NET 框架中内置的 List 类型,或者 字符串集合。
最简单的是通用列表:
但是 StringCollection 有一些位列表中没有;您可以在
使用内置 .NET Framework 类的优点是 MSDN 上有大量文档,其中有大量示例(例如CodeProject),并且通常支持更多功能(例如实现数据绑定所需的接口等) :ShineOn 中的 TStringList 不会这样做)。
使用类似 VCL 的优点是您对 VCL 更加熟悉,因此可以更快地上手。但 VCL.NET 没有得到进一步发展是有原因的...
Janka Janos 有一个很棒的 C# 和 Delphi Prism 中的功能比较表。
这将帮助您将 C# 示例转换为 Delphi Prism 代码。
——杰罗恩
Just use the built in List types in the .NET framework, or the StringCollection.
The easiest are the generic lists:
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
您看过 ShineOn 吗?它有一个 Classes.pas 其中包含 TStringList。
Have you looked at ShineOn? It has a Classes.pas with TStringList in it.
我在我完成的一点 C# 中使用了 Collections.Specialized.HybridDictionary (和类似的)类。由于它是一个标准的 .net 对象,因此应该在 Prism 中可用。
我不知道它是否有 LoadFrom/Save to file
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