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
範例
應用程式資料範例

 

 

顯示:
© 2015 Microsoft