title: Is this an abuse of the Settings Feature?
body: <p>I've been storing collections of user settings in the <code>Properties.Settings.Default</code> object and using the Visual Studio settings designer (right-click on your project, click on Properties and then click on the Settings tab) to set the thing up. Recently, several users have complained that the data this particular setting tracks is missing, randomly. </p>
  
  <p>To give an idea (not exactly how I do it, but somewhat close), the way it works is I have an object, like this:</p>
  
  <pre><code>class MyObject
  {
      public static string Property1 { get; set; }
      public static string Property2 { get; set; }
      public static string Property3 { get; set; }
      public static string Property4 { get; set; }
  }
  </code></pre>
  
  <p>Then in code, I might do something like this to save the information:</p>
  
  <pre><code>public void SaveInfo()
  {
      ArrayList userSetting = new ArrayList();
      foreach (Something s in SomeCollectionHere) // For example, a ListView contains the info
      {
          MyObject o = new MyObject {
              Property1 = s.P1;
              Property2 = s.P2;
              Property3 = s.P3;
              Property4 = s.P4;
          };
          userSetting.Add(o);
      }
      Properties.Settings.Default.SettingName = userSetting;
  }
  </code></pre>
  
  <p>Now, the code to pull it out is something like this:</p>
  
  <pre><code>public void RestoreInfo()
  {
      ArrayList setting = Properties.Settings.Default.SettingName;
  
      foreach (object o in setting)
      {
          MyObject data = (MyObject)o;
          // Do something with the data, like load it in a ListView
      }
  }
  </code></pre>
  
  <p>I've also made sure to decorate the Settings.Designer.cs file with <code>[global::System.Configuration.SettingsSerializeAs(global::System.Configuration.SettingsSerializeAs.Binary)]</code>, like this:</p>
  
  <pre><code>    [global::System.Configuration.UserScopedSettingAttribute()]
      [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
      [global::System.Configuration.SettingsSerializeAs(global::System.Configuration.SettingsSerializeAs.Binary)]
      public global::System.Collections.ArrayList SettingName
      {
          get {
              return ((global::System.Collections.ArrayList)(this["SettingName"]));
          }
          set {
              this["SettingName"] = value;
          }
      }
  </code></pre>
  
  <p>Now, randomly, the information will disappear. I can debug this and see that <code>Properties.Settings.Default</code> is returning an empty <code>ArrayList</code> for <code>SettingName</code>. I would really rather not use an ArrayList, but I don't see a way to get a generic collection to store in this way.</p>
  
  <p>I'm about to give up and save this information using plain XML on my own. I just wanted to verify that I was indeed pushing this bit of .NET infrastructure too far. Am I right?</p>