Windows Phone app settings container object Applicationdatacontainer

Source: Internet
Author: User

App settings are packaged data storage in Windows Phone, a collection of key-value pairs saved in the application store, which automatically serializes objects and saves them in the application.

When the application is deleted, the saved data disappears as well, and this method primarily stores some application settings information.

Basic Features:

1, the application settings have a hierarchy of containers, so the container can also be nested inside the container, the container can nest up to 32 layers.

2. The application settings store a single data type object.

How to use:

1. Get the local Application settings container:

Applicationdatacontainer _appsetting = ApplicationData.Current.LocalSettings;

2, add and modify should be set

   _appsetting.values["keys""WP Learning ";

Note: If a key does not exist, a new one is added, and if there is already a key, the original value is modified.

3. Reading should be set

string values = _appsetting.values[keys]. ToString ();

4. Delete app settings

   _appsetting.values.remove ("keys");

To set the presence container:

// created if the container does not exist Applicationdatacontainer container = _appsetting.createcontainer ("newcontainer", Applicationdatacreatedisposition.always);

Delete Container

  _appsetting.deletecontainer ("newcontainer");

Adding information on a new container

            // determine if the container exists            if (_appsetting.containers.containskey ("newcontainer"))            {                _appsetting.containers["newcontainer"]. values["keys""hello wp";            }

Delete information on a container

           if (_appsetting.containers.containskey ("newcontainer"))            {                _appsetting.containers["newcontainer"]. Values.remove ("keys");            

Windows Phone app settings container object Applicationdatacontainer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.