Skip to main content
ApplicationDataContainer.Values | values property

Gets an object that represents the settings in this settings container.

Syntax


var values = applicationDataContainer.values;

public IPropertySet Values { get; }

Public ReadOnly Property Values As IPropertySet

public:
property IPropertySet^ Values { 
   IPropertySet^ get();
}

Property value

Type: IPropertySet

The settings map object.

Examples

Use the LocalSettings | localSettings property to get the settings in an ApplicationDataContainer object. Use the ApplicationDataContainer.Values | ApplicationDataContainer.values property to access the settings in the localSettings container. This example creates and reads a setting named exampleSetting.

Call the ApplicationDataContainerSettings.Remove | ApplicationDataContainerSettings.remove method to delete the exampleSetting setting when you have finished with it.


var applicationData = Windows.Storage.ApplicationData.current;

var localSettings = applicationData.localSettings;

// Create a simple setting

localSettings.values["exampleSetting"] = "Hello Windows";

// Read data from a simple setting

var value = localSettings.values["exampleSetting"];
        
if (!value)
{
    // No data
}
else
{
    // Access data in value
}

// Delete a simple setting

localSettings.values.remove("exampleSetting");

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

// Create a simple setting

localSettings.Values["exampleSetting"] = "Hello Windows";

// Read data from a simple setting

Object value = localSettings.Values["exampleSetting"];

if (!value)
{
    // No data
}
else
{
    // Access data in value
}

// Delete a simple setting

localSettings.Values.Remove("exampleSetting");

Dim localSettings As Windows.Storage.ApplicationDataContainer = Windows.Storage.ApplicationData.Current.LocalSettings

' Create a simple setting

localSettings.Values("exampleSetting") = "Hello Windows";

' Read data from a simple setting

Dim value As Object = localSettings.Values("exampleSetting")

If value Is Nothing Then
   ' No data
Else
   ' Access data in value
End If

' Delete a simple setting

localSettings.Values.Remove("exampleSetting")

ApplicationDataContainer^ localSettings = ApplicationData::Current->LocalSettings;

// Create a simple setting

auto values = localSettings->Values;
values->Insert("exampleSetting", dynamic_cast<PropertyValue^>(PropertyValue::CreateString("Hello Windows")));

// Read data from a simple setting

auto values = localSettings->Values;
String^ value = safe_cast<String^>(localSettings->Values->Lookup("exampleSetting"));

if (!value)
{
    // No data
}
else
{
    // Access data in value
}

// Delete a simple setting

values->Remove("exampleSetting");

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Storage
Windows::Storage [C++]

Metadata

Windows.winmd

See also

Tasks
Quickstart: Local application data (JavaScript)
Store and retrieve settings and other app data
Quickstart: Roaming application data (JavaScript)
Store and retrieve settings and other app data
Concepts
Store and retrieve settings and other app data
Reference
ApplicationDataContainer