Is there a procedure to initialize a variable number of objects at runtime in a single procedure?
I usually have initialize some variables like the TStringList type at the start of procedures and free them afterwards.It feels awkward to initialize the separately, like
listOne := TStringList.Create;
listTwo := TStringList.Create;
listTree := TString.Create;{ etc, etc}
I would prefer a procedure like, with another for Free ing them a the end:
CreateStrings(listOne, listTwo, listThree);
CreateStrings([listOne, listTwo, listTree]); //using an array
Is there a procedure that can do something like this for a variable number of objects?
If it can't be done for arbitrary object types, then at least types with the same Create signature?