Represents related app settings that must be serialized and deserialized atomically.
Syntax
public sealed class ApplicationDataCompositeValue : Object, IPropertySet, IObservableMap<String, Object>, IDictionary<String, Object>, IEnumerable<KeyValuePair>
Attributes
- ActivatableAttribute(NTDDI_WIN8)
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- ThreadingAttribute(MTA)
- VersionAttribute(NTDDI_WIN8)
Members
The ApplicationDataCompositeValue class has these types of members:
Constructors
The ApplicationDataCompositeValue class has these constructors.
| Constructor | Description |
|---|---|
| ApplicationDataCompositeValue | Creates and initializes a new, initially empty, instance of the object. |
Events
The ApplicationDataCompositeValue class has these events.
| Event | Description |
|---|---|
| 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.
| Method | Description |
|---|---|
| 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 specified application setting. |
| 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.
| Property | Access type | Description |
|---|---|---|
|
Count [C#, VB] | Read-only | Gets the number of elements contained in the collection. |
|
IsReadOnly [C#, VB] | Read-only | Gets a value indicating whether the dictionary is read-only. |
|
Item [C#, VB] | Read/write | Gets or sets the element value at the specified key index. |
|
Keys [C#, VB] | Read-only | Gets an ICollection object containing the keys of the ApplicationDataCompositeValue. |
|
Size [C++, JavaScript] | Read-only | Gets the number of related application settings. |
|
Values [C#, VB] | Read-only | Gets 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.
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings; // Create a composite setting Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue(); composite["intVal"] = 1; composite["strVal"] = "string"; localSettings.Values["exampleCompositeSetting"] = composite; // Read data from a composite setting Windows.Storage.ApplicationDataCompositeValue composite = (Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["exampleCompositeSetting"]; if (composite == null) { // 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] |
|
Namespace |
|
|
Metadata |
|
|
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
Build date: 2/25/2013