RTL-Generics question/suggestion regarding TCustomList.ToArray lazarus / 64-FPC development ---------------------------------------------------------------------- SlightlyOutOfPhase · 2016-11-13 01:23 . ---------------------------------------------------------------------- Thaddy · 2016-11-13 06:22 Instead of modifying an existing abstract class, you should derive a new class if you need that functionality. Btw: it is of course only faster if the array is accessed sequentially. You loose the enumerator support. ---------------------------------------------------------------------- Thaddy · 2016-11-15 17:05 Quote from: SlightlyOutOfPhase on November 15, 2016, 04:07:08 pmWell yes, it's certainly true that I could derive a new class. I was merely suggesting to add it to the TCustomList class specifically since that is the class that the major commonly used Generic list classes (TList, TObjectList, e.t.c) descend from, so if it were added at that level they would all have it by default. I knew that. I still stick to my answer. Because of the same reasoning. In addition: if you need that kind of array access you chose the wrong structure. But that is merely theory. I appreciate you want to see it in the base class. I think that is wrong, but it won't hurt much for average users. ---------------------------------------------------------------------- hnb · 2016-11-24 12:53 Quote from: SlightlyOutOfPhase on November 20, 2016, 12:47:19 amSo many more views than when I last posted, but no one has any input? TList has FItems in protected section. You can create "class helper" to expose FItems or you can create descendant class from TList. Situation is not bad FItems in Delphi is declared in private section. If you really like to have AsArray please create bug report on bugtracker. ---------------------------------------------------------------------- marcov · 2016-11-24 13:49 Download the code in the  http://forum.lazarus.freepascal.org/index.ph p/topic,30556.msg194484.html#msg194484 topic, and look at the units glhelper/gloverlayhelp Basically I exported the pointer value and the elementsize from my generic class.