System.Classes.TStrings.AddObject

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function AddObject(const S: string; AObject: TObject): Integer; virtual;

C++

virtual int __fastcall AddObject(const System::UnicodeString S, System::TObject* AObject);

Properties

Type Visibility Source Unit Parent
function public
System.Classes.pas
System.Classes.hpp
System.Classes TStrings

Description

Adds a string to the list, and associates an object with the string.

Call AddObject to add a string and its associated object to the list. AddObject returns the index of the new string and object.

Note: The TStrings object does not own the objects you add this way. Objects added to the TStrings object still exist even if the TStrings instance is destroyed. They must be explicitly destroyed by the application.

See Also

Code Examples