IsolatedStorageSettings.Remove Method

May 11, 2014

Removes the entry with the specified key.

Namespace:  System.IO.IsolatedStorage
Assembly:  System.Windows (in System.Windows.dll)

public bool Remove(
	string key
)

Parameters

key
Type: System.String
The key for the entry to be deleted.

Return Value

Type: System.Boolean
true if the specified key was removed; otherwise, false.

Implements

IDictionary<TKey, TValue>.Remove(TKey)

ExceptionCondition
ArgumentNullException

key is null.

Use this method to remove key-value pairs from isolated storage. If the key does not exist, the method returns false; no entry is deleted and no exception is thrown.

The following example tries to remove a key-value pair for the user's name from the settings dictionary. A message is displayed in a TextBox named tbResults that indicates whether the name was removed or not found. This example is part of a larger example for the IsolatedStorageSettings class.


if (userSettings.Remove("name") == true)
{
    tbResults.Text = "Name removed. Refresh page to see changes.";
}
else
{
    tbResults.Text = "Name could not be removed. Key does not exist.";
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft