ApplicationDataContainerSettings class

Applies to Windows and Windows Phone

Provides access to the settings in a settings container.

Syntax


Public NotInheritable Class ApplicationDataContainerSettings
    Implements IPropertySet, _
    IObservableMap(Of String, Object), _
    IDictionary(Of String, Object), _
    IEnumerable(Of 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 an 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

Collection member lists

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

Examples

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

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


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

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