ApplicationDataCompositeValue class

Applies to Windows and Windows Phone

Represents related app settings that must be serialized and deserialized atomically.

Syntax


var applicationDataCompositeValue = new Windows.Storage.ApplicationDataCompositeValue();

Attributes

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

Members

The ApplicationDataCompositeValue class has these types of members:

Constructors

The ApplicationDataCompositeValue class has these constructors.

ConstructorDescription
ApplicationDataCompositeValue Creates and initializes a new, initially empty, instance of the object.

 

Events

The ApplicationDataCompositeValue class has these events.

EventDescription
MapChanged Occurs when the map changes.

 

Methods

The ApplicationDataCompositeValue 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 ApplicationDataCompositeValue.
Add(String) [C#, VB]Adds an item to the ApplicationDataCompositeValue.
Clear Removes all application settings previously inserted into the composite value object, returning the object to its empty state.
Contains [C#, VB]Returns a value that indicates whether a specified key-value pair exists in the ApplicationDataCompositeValue.
ContainsKey [C#, VB]Returns a value that indicates whether a specified key exists in the ApplicationDataCompositeValue.
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 composite value.
GetView [C++, JavaScript]Returns a read-only snapshot of the contents of the composite value.
HasKey [C++, JavaScript]Determines whether there is an application setting with the specified key.
Insert [C++, JavaScript]Creates or replaces an application setting.
Lookup [C++, JavaScript]Retrieves the specified application setting.
Remove [C++, JavaScript]Removes the value with the specified key.
Remove(KeyValuePair) [C#, VB]Removes a specific key-value pair from the ApplicationDataCompositeValue.
Remove(String) [C#, VB]Removes a specific item from the ApplicationDataCompositeValue.
TryGetValue [C#, VB]Returns a value that indicates whether a specified key exists in the ApplicationDataCompositeValue. If an item with that key exists, the item is retrieved as an out parameter.

 

Properties

The ApplicationDataCompositeValue 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 ApplicationDataCompositeValue.

Size [C++, JavaScript]

Read-onlyGets the number of related application settings.

Values [C#, VB]

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

 

Remarks

A composite setting is serialized by inserting it into a settings map and deserialized by looking it up from the map.

Collection member lists

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

Examples

This example creates and reads a composite setting named exampleCompositeSetting.

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


var applicationData = Windows.Storage.ApplicationData.current;

var localSettings = applicationData.localSettings;

// Create a composite setting

var composite = new Windows.Storage.ApplicationDataCompositeValue();
composite["intVal"] = 1;
composite["strVal"] = "string";

localSettings.values["exampleCompositeSetting"] = composite;

// Read data from a composite setting

var composite = localSettings.values["exampleCompositeSetting"];

if (!composite)
{
    // No data
}
else
{
    // Access data in composite["intVal"] and composite["strVal"]
}

// Delete a composite setting

localSettings.values.remove("exampleCompositeSetting");

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
ApplicationDataContainer
ApplicationDataContainerSettings
Samples
Application data sample

 

 

Show:
© 2014 Microsoft