Replacement for TList in Delphi Prism.

I am migrating an application written in Delphi 2007 to Delphi Prism, what is the best option to replace the TList class?

Thanks in advance.

Bye.

+2


source to share


1 answer


You don't specify whether you mean a simple TList or the generic TList introduced with generics in D2009, although I feel like it is a simple TList.

Use List <t> if you want to use generics. This means that you don't have to do manual casting every time you grab something from your list. In general, you probably want to use this one unless you have a specific reason. You should also use this if you are already using TList in your Delphi application - if memory is in use, CodeGear intentionally adapted the interface from the .NET List when adding generics in D2009.



If you want a non-generic version that just stores objects (like a TList) check out ArrayList . This matches your current implementation more closely (assuming a simple TList), but you lose the compilation type safety that you can get from using generics.

+7


source







All Articles