[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPGMapInterfacedObjectData.Add

Add a key and value to the map

## Declaration

Source position: fgl.pp line 419

`public function TFPGMapInterfacedObjectData.Add(`
`const AKey: TKey;`
`const AData: TData`
`):Integer; function TFPGMapInterfacedObjectData.Add(`
`const AKey: TKey`
`):Integer;`

## Arguments

`AKey` |  | Key value
`AData` |  | Data item

## Function result

Index of the new key

## Arguments

`AKey` |  | Key value

## Description

Add adds a new key AKey of generic type TKey with data value AData to the list and returns the position at which the key was added.

## Errors

If the item could not be added, an EListError exception is raised. If Duplicates is set to dupError and a duplicate key is added, an EListError exception is raised.

## See also

TFPGMapInterfacedObjectData.Keys |  | Indexed access to the keys in the list.
TFPGMapInterfacedObjectData.IndexOf |  | Find index of a key in the list.
TFPGMapInterfacedObjectData.KeyData |  | Access to data based on key
TFPGMapInterfacedObjectData.Data |  | Indexed access to the data in the list
TFPS.Duplicates

Documentation generated on: May 14 2021