I've created a class like
TMyClass = class(TObject)
private
FList1: TObjectList<List1>;
FList2: TObjectList<List2>;
public
end;
Now, I want a method FillArray(Content);, which preferably should be implemented once, i.e. no overload. I believe this is possible using generics, but I'm too inexperienced with these beasts to actually implement it. Do anyone have a clue? Thanks in advance!
The following I believe will only work in Delphi 2010. As it depends on the declaration of TArray<T> in the system unit, that looks like this:
Here is unit I have developed to help with TArray to List conversions
Since TList<T>is the parent class for TObjectList<T> this should work with TObjectList<T> although I have not tried it.