Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving list or array to applicationsettings using custom class
    primarykey
    data
    text
    <p>I am currently using the application settings class found in admam nathan's book 101 Windows Phone Apps:</p> <pre><code> public class Setting&lt;T&gt; { string name; T value; T defaultValue; bool hasValue; public Setting(string name, T defaultValue) { this.name = name; this.defaultValue = defaultValue; } public T Value { get { //checked for cached value if (!this.hasValue) { //try to get value from isolated storage if (!IsolatedStorageSettings.ApplicationSettings.TryGetValue(this.name, out this.value)) { //not set yet this.value = this.defaultValue; IsolatedStorageSettings.ApplicationSettings[this.name] = this.value; } this.hasValue = true; } return this.value; } set { //save value to isolated storage IsolatedStorageSettings.ApplicationSettings[this.name] = value; this.value = value; this.hasValue = true; } } public T DefaultValue { get { return this.defaultValue; } } //clear cached value; public void ForceRefresh() { this.hasValue = false; } } </code></pre> <p>and then in a seperate class:</p> <p>public static class Settings { //user settings from the settings menu</p> <pre><code> public static readonly Setting&lt;bool&gt; IsAerialMapStyle = new Setting&lt;bool&gt;("IsAerialMapStyle", false); </code></pre> <p>}</p> <p>It all works fine but I can't work out how to save an array or list of length 24 to the application settings using this method. </p> <p>I have this so far:</p> <pre><code> public static readonly Setting&lt;List&lt;bool&gt;&gt; ListOpened = new Setting&lt;List&lt;bool&gt;&gt;("ListOpened",.... </code></pre> <p>Any help would be much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload