Share via


PreferencesStore.ResetValue(String) Method

Definition

Removes the name/value pair from the preference store.

public:
 void ResetValue(System::String ^ name);
public void ResetValue (string name);
member this.ResetValue : string -> unit
Public Sub ResetValue (name As String)

Parameters

name
String

The name of the item to remove.

Exceptions

name is null or empty.

Examples

The following example shows the contents of a preference store item before and after calling the ResetValue method.

void TrcVal(string name, string strDefault) {

    PreferencesStore store = MyPrefStore;

    bool b = store.ContainsValue(name);
    if (b == false)
        Trace.WriteLine(name + " Not in store");

    string strVal = store.GetValue(name, strDefault);
    Trace.WriteLine(name + "Value = \""
        + strVal + "\"");

}
void TrcResetVal(string name, string strDefault) {

    PreferencesStore store = MyPrefStore;

    Trace.WriteLine("Before reset");
    TrcVal(name, strDefault);

    store.ResetValue(name);

    Trace.WriteLine("reset called");
    TrcVal(name, strDefault);
}

Applies to