Download Now

    Reference TObjectList<TItem>

    Declared in Codebot.Collections.pas on line 153

    TObjectList<TItem> holds objects and can optionally be set to manage their life
      TObjectList<TItem: TObject> = class(TIndexedList<TItem>)
      protected
        { Prevents items from being added twice }
        procedure AddItem(constref Item: ItemType); override;
        { Frees the items if the list owns the objects }
        procedure DeleteItem(var Item: ItemType); override;
        { Returns true if the list owns the objects }
        function RequiresDelete: Boolean; override;
      public
        { Create the list optionally owning objects added to it }
        constructor Create(OwnsObjects: Boolean);
        { Returns the index of the object or -1 if it cannot be found }
        function IndexOf(const Item: ItemType): Integer; override;
        { Allow, ignore, or error on adding a duplicate object }
        property Duplicates;
      end;

    See also