Add key-value pair.
Add adds a key and its corresponding value to the dictionary. Both the key and the value can be nil.
If the key already exists in the dictionary, an exception is thrown.
An OnKeyNotify event and an OnValueNotify event occur indicating that an entry was added to the dictionary.
The Items property lists all dictionary entries. You can also set and get values by indexing directly the Items property. For instance, you can set a value this way:
Delphi
Items[key] := value;
Setting the value this way overwrites the value for an existing key, but does not raise an exception.
Namespace: RSGenerics.Collections
Delphi |
public |
Parameters
Key
Type: TKey
Value
Type: TValue