ApplicationDataContainerSettings class

Applies to Windows and Windows Phone

Provides access to the settings in a settings container. The ApplicationDataContainer.Values property returns an object that can be cast to this type.

Syntax


public sealed class ApplicationDataContainerSettings : IPropertySet,
    IObservableMap<String, Object>,
    IDictionary<String, Object>,
    IEnumerable<KeyValuePair>

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The ApplicationDataContainerSettings class has these types of members:

Events

The ApplicationDataContainerSettings class has these events.

EventDescription
MapChanged Occurs when the map changes.

 

Methods

The ApplicationDataContainerSettings class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Add(KeyValuePair) [C#, VB]Adds a new key-value pair to the ApplicationDataContainerSettings.
Add(String) [C#, VB]Adds a new item to the ApplicationDataContainerSettings.
Clear Removes all related application settings.
Contains [C#, VB]Returns a value that indicates whether a specified key-value pair exists in the ApplicationDataContainerSettings.
ContainsKey [C#, VB]Returns a value that indicates whether a specified key exists in the ApplicationDataContainerSettings.
CopyTo [C#, VB]Copies the elements of the collection to an array, starting at a particular array index.
First [C++, JavaScript]Retrieves an iterator to enumerate the settings in the settings container.
GetView [C++, JavaScript]Returns a read-only snapshot of the contents of the settings container.
HasKey [C++, JavaScript]Determines whether there is an application setting with the specified key.
Insert [C++, JavaScript]Inserts or replaces an application setting.
Lookup [C++, JavaScript]Retrieves the specified application setting.
Remove [C++, JavaScript]Removes the specified application setting.
Remove(KeyValuePair) [C#, VB]Removes a specific key-value pair from the ApplicationDataContainerSettings.
Remove(String) [C#, VB]Removes a specific item from the ApplicationDataContainerSettings.
TryGetValue [C#, VB]Returns a value that indicates whether a specified key exists in the ApplicationDataContainerSettings. If an item with that key exists, the item is retrieved as an out parameter.

 

Properties

The ApplicationDataContainerSettings class has these properties.

PropertyAccess typeDescription

Count [C#, VB]

Read-onlyGets the number of elements contained in the collection.

IsReadOnly [C#, VB]

Read-onlyGets a value indicating whether the dictionary is read-only.

Item [C#, VB]

Read/writeGets or sets the element value at the specified key index.

Keys [C#, VB]

Read-onlyGets an ICollection object containing the keys of the ApplicationDataContainerSettings.

Size [C++, JavaScript]

Read-onlyGets the number of related application settings.

Values [C#, VB]

Read-onlyGets an ICollection object containing the values of the ApplicationDataContainerSettings.

 

Remarks

To get an app's local settings, do the following things. These steps are demonstrated in the example on this page.

  1. Get the value of the static ApplicationData.Current property. This property returns a data store of type ApplicationData.
  2. Get the value of the data store's LocalSettings property. This property returns a data container of type ApplicationDataContainer.
  3. Read the Values property of the data container. This property returns a group of settings of type IPropertySet, which can be cast to the ApplicationDataContainerSettings type.

Collection member lists

For JavaScript, ApplicationDataContainerSettings supports using an index to access items.

Examples

This example uses the LocalSettings | localSettings property to get an app's local settings. Then it uses the ApplicationDataContainer.Values | values property to access the settings in the localSettings container, which is of type ApplicationDataContainerSettings.

The example creates and reads a setting named exampleSetting. Later it calls the ApplicationDataContainerSettings.Remove | remove method to delete the exampleSetting setting.


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

Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

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

DLL

Windows.Storage.ApplicationData.dll

See also

Tasks
Quickstart: Local application data (JavaScript)
Quickstart: Local application data (C#/VB/C++)
Quickstart: Roaming application data (JavaScript)
Quickstart: Roaming application data (C#/VB/C++)
Concepts
Application data overview
Reference
ApplicationData
ApplicationDataCompositeValue
ApplicationDataContainer
Samples
Application data sample

 

 

Show:
© 2014 Microsoft