Operator Scope of Action:
Operator First Added:
This sets a key to the value.
If key does not exist, that key is created with a value of value.
If key exists, key is given value value. This replaces any/all existing values for this key.
Assume $MyDictionary has no 'apple' key. Example:
$MyDictionary = $MyDictionary.add("apple","fruit");
The key 'apple' is added and now has value 'fruit'
$MyDictionary = $MyDictionary.add("apple","green");
The key 'apple' now has a new value 'green'. Now assume the 'apple' key has multiple values of 'fruit;green;red':
$MyDictionary = $MyDictionary.add("apple","pie");
Now the value is just 'pie' because a .add() operator replaces all existing value(s). To add an additional value(s) to existing value(s), see Dictionary.extend().
This operator is also equivalent to:
Dictionary["key"] = "value";