System.Contnrs.TObjectList.OwnsObjects
Delphi
property OwnsObjects: Boolean read FOwnsObjects write FOwnsObjects;
C++
__property bool OwnsObjects = {read=FOwnsObjects, write=FOwnsObjects, nodefault};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | System.Contnrs.pas System.Contnrs.hpp |
System.Contnrs | TObjectList |
Description
Allows TObjectList to free objects when they are deleted from the list or the list is destroyed.
OwnsObjects allows TObjectList to control the memory of its objects. If OwnsObjects is true (the default):
- Calling Delete or Remove frees the deleted object in addition to removing it from the list.
- Calling Clear frees all the objects in the list in addition to emptying the list.
- Calling the destructor frees all the objects in the list in addition to destroying the TObjectList itself.
- Assigning a new value to an index in Items frees the object that previously occupied that position in the list.
Even if OwnsObjects is true, the Extract method can be used to remove objects from the list without freeing them.