ApplicationDataContainerSettings Class

在设置容器中提供对设置容器的访问。

语法


Public NotInheritable Class ApplicationDataContainerSettings
    Implements IPropertySet, _
    IObservableMap(Of String, Object), _
    IDictionary(Of String, Object), _
    IEnumerable(Of KeyValuePair)

特性

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

成员

ApplicationDataContainerSettings类 具有以下类型的成员:

事件

ApplicationDataContainerSettings类 具有以下事件。

事件描述
MapChanged Occurs when the map changes.

 

方法

The ApplicationDataContainerSettings 类 具有以下方法。 使用 C#、Visual Basic 和 C++,它还可以继承以下内容中的方法 Object 类.

方法描述
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.

 

属性

ApplicationDataContainerSettings类 具有以下属性。

属性访问类型描述

Count [C#, VB]

只读Gets the number of elements contained in the collection.

IsReadOnly [C#, VB]

只读Gets a value indicating whether the dictionary is read-only.

Item [C#, VB]

读取/写入Gets or sets the element value at the specified key index.

Keys [C#, VB]

只读Gets an ICollection object containing the keys of the ApplicationDataContainerSettings.

Size [C++, JavaScript]

只读Gets the number of related application settings.

Values [C#, VB]

只读Gets an ICollection object containing the values of the ApplicationDataContainerSettings .

 

备注

集合成员列表

对于 JavaScript,ApplicationDataContainerSettings 支持使用索引访问项目。

示例

使用 LocalSettings | localSettings 属性可以获取在 ApplicationDataContainer 对象中的设置。使用 ApplicationDataContainer.Values | values 属性可以访问在 localSettings 容器中的设置。此示例创建并读取名为 exampleSetting 的设置。

调用 ApplicationDataContainerSettings.Remove | 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")

要求

最低受支持的客户端

Windows 8 [Windows 应用商店应用, 桌面应用]

最低受支持的服务器

Windows Server 2012 [Windows 应用商店应用, 桌面应用]

命名空间

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

元数据

Windows.winmd

DLL

Windows.Storage.ApplicationData.dll

另请参阅

任务
快速入门:本地应用程序数据 (JavaScript)
快速入门:本地应用程序数据 (C#/VB/C++)
快速入门:漫游应用程序数据 (JavaScript)
快速入门:漫游应用程序数据 (C#/VB/C++)
概念
应用程序数据概述
引用
ApplicationData
ApplicationDataCompositeValue
ApplicationDataContainer
示例
应用程序数据示例

 

 

显示:
© 2014 Microsoft