Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
TObjectList expands Tlist by adding the option to take ownership for the Tobject items added to the list through the use of the "OwnsObjects" property. Setting "OwnsObjects" to true will allow the object list to free the memory for each item in the list when the Tobjectlist is freed or removed from the list. Basic methods from Tlist such as add, delete, rearrange, locate, access, and sort remain accessible.
(Known issues / Documentation clarifications / Things to be aware of)
Procedure OwnedObjectDemo; Var MyObject: TObject; MyList: TObjectlist; Begin MyObject := TObject.Create; MyList := TObjectList.Create(True); // OwnsObjects is True.OwnsObjects by default is true so just MyList := TObjectList.Create; would be enough here. MyList.Add(MyObject); //operating code.... MyList.Free; //MyObject is also freed since the TObjectList was created with the OwnsObjects property set to true. End;
(Please provide links to articles/source code that show how to use this item.)
(Please provide links to items specifically related to this item.)
(Please leave your name with your comment.)