RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TWideStringList.AddObject Method

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

Pascal
function AddObject(const S: WideString; AObject: TObject): Integer; override;
C++
virtual __fastcall int AddObject(const BSTR S, TObject * AObject);

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 TWideStringList object does not own the objects you add this way. Objects added to the TWideStringList object still exist even if the TWideStringList instance is destroyed. They must be explicitly destroyed by the application.
Note: For sorted lists, AddObject raises an EListError exception if the string S already appears in the list and Duplicates is set to dupError. If Duplicates is set to dupIgnore, trying to add a duplicate string causes AddObject to return the index of the existing entry.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!