I am migrating an application written in Delphi 2007 to Delphi Prism, which is the best option to replace the TList class?
Thanks in advance.
Bye.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t specify if you mean the plain TList or the generic TList introduced with generics in D2009, although I have a feeling it’s the plain TList.
Use List<T> if you want to use generics. That means you don’t have to do manual typecasting every time you take something out of your list. In general, you would probably want to use this one unless you have a specific reason not to. You should also use this if you are already using TList in your Delphi application – if memory serves, CodeGear deliberately adapted the interface from the .NET List when adding generics in D2009.
If you want a non-generic version, which just stores Objects (much like TList), look at ArrayList. This maps more closely to your current implementation (assuming plain TList), but you lose the compile-time type safety you can get from using generics.