.NET Framework Class Library for Silverlight
IsolatedStorageSettings..::.Remove Method

Removes the entry with the specified key.

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

Visual Basic (Declaration)
Public Function Remove ( _
    key As String _
) As Boolean
Visual Basic (Usage)
Dim instance As IsolatedStorageSettings
Dim key As String
Dim returnValue As Boolean

returnValue = instance.Remove(key)
C#
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<(Of <(TKey, TValue>)>)..::.Remove(TKey)
Exceptions

ExceptionCondition
ArgumentNullException

key is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

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.

Examples

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.

Visual Basic
If userSettings.Remove("name") = True Then
    tbResults.Text = "Name removed. Refresh page to see changes."
Else
    tbResults.Text = "Name could not be removed. Key does not exist."
End If
C#
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.";
}
Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Tags :


Page view tracker