Share via


PreferencesStore.ContainsValue(String) Method

Definition

Gets a value indicating whether the specified name exists in the preference store.

public:
 bool ContainsValue(System::String ^ name);
public bool ContainsValue (string name);
member this.ContainsValue : string -> bool
Public Function ContainsValue (name As String) As Boolean

Parameters

name
String

The name of the preference store item.

Returns

true if the name is in the store; otherwise, false.

Exceptions

name is null or empty.

Examples

The following example checks for a name in the preference store.

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 + "\"");

}

Remarks

This method searches for the name, not the value, in the store.

Applies to