Skip to content

TIniCollection.SaveToIni

Save the collection to a TCustomIniFile descendent.

Declaration

Source position: inicol.pp line 54

public 
procedure TIniCollection.SaveToIni(Ini: TCustomIniFile; Section: string)
                                  ;  virtual;

Description

SaveToIni does the actual writing. It writes the number of elements in the global section (as specified by the Section argument), as well as the section name for each item in the list. The item names are written using the Prefix property for the key. After this it calls the SaveToIni method of all TIniCollectionItem instances.

This means that the global section of the .ini file will look something like this:

[globalsection]
Count=3
Prefix1=SectionPrefixFirstItemName
Prefix2=SectionPrefixSecondItemName
Prefix3=SectionPrefixThirdItemName

This construct allows to re-use an ini file for multiple collections.

After this method is called, the GlobalSection property contains the value of Section, it will be used in the Save method.

See also

Name Description
TIniCollectionItem.SaveToIni Method called when the item must be saved.
TIniCollection.Save Save the collection to the default filename.