IsolatedStorageSettings.Add Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Adds an entry to the dictionary for the key-value pair.
Assembly: System.Windows (in System.Windows.dll)
Parameters
- key
- Type: System.String
The key for the entry to be stored.
- value
- Type: System.Object
The value to be stored.
Implements
IDictionary<TKey, TValue>.Add(TKey, TValue)| Exception | Condition |
|---|---|
| ArgumentNullException | key is null. |
| ArgumentException | key already exists in the dictionary. |
The following example tries to add a key-value pair for the user's name to the settings dictionary. If the data is added successfully, a confirmation is displayed in a TextBox named tbResults. If the key already exists, an exception message is displayed. This example is part of a larger example for the IsolatedStorageSettings class.