DGL
https://delphigl.com/forum/

array of VS tlist
https://delphigl.com/forum/viewtopic.php?f=19&t=3364
Seite 1 von 1

Autor:  noeska [ So Okt 17, 2004 18:48 ]
Betreff des Beitrags:  array of VS tlist

what should be prefered: array of typename or TList?

With array of you should take care of memory yourself
With tlist you must use typecasting or make an inherited version of tlist

Wat is the best way to use?

Autor:  Sascha Willems [ So Okt 17, 2004 18:55 ]
Betreff des Beitrags: 

There is no "this is the best for all" in this question. I mostly use array of, because it's easy to handle and you don't have to do any typecasts. But especially if you do many operations on the list itself during runtime (sorting, removing items, adding items inbetween) a TList is the better way to go, since it already comes with many needed functions.

Autor:  McCLaw [ Di Okt 19, 2004 14:03 ]
Betreff des Beitrags: 

I generally follow the rule below.

If I want to list TObject/TPersistent instances, I use TObjectList
If I use primitive types (Int, String, whatever) I use dynamic arrays.

The reason for using TObjectList, is that I clears its own memory, and the mem of the object instances inside it when you free it.

Very handy when you have hundereds of objects to keep track of. :) :D

Autor:  LarsMiddendorf [ Di Okt 19, 2004 16:02 ]
Betreff des Beitrags: 

A linked list or hashtable is also usefull sometimes.

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/