Posted on 2001-06-22
I have created a new type TMyType. Now I want to have a random number of this type in a list, array, etc.
I first used a TObjectList, which worked fine, but I got some ugly code, because I had to typecast to my type the whole time.
Like this (ObjectList[i] as TMyType).SomeProperty
I could use an array to make the code a bit nicer, but as I add and remove objects an array won't do.
Is it possible to create an ObjectList that works with TMyType.
It would be perfect if something like templates from C++ were around.