[Overview][Constants][Classes][Index] | Reference for unit 'inicol' (#fcl)

# TIniCollection.SaveToIni

Save the collection to a TCustomIniFile descendent

## Declaration

Source position: inicol.pp line 35

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

## Arguments

`Ini` |  | Inifile class to use when writing data.
`Section` |  | Section to which to write the global data

## 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

TIniCollectionItem.SaveToIni |  | Method called when the item must be saved

Documentation generated on: Feb 26 2014