1

I am trying to save and restore a list of GUID objects with in a subclass of ApplicationSettingsBase. It saves what appears to be correct information to the XML file, but when restoring, the list object is null. Here is the snippet of the ApplicationSettingsBase class and the property.

public class AppData: ApplicationSettingsBase
{
   ...

   [UserScopedSettings()]
   public List<Guid> LibrarySortOrder
   {
      get {
         return (List<Guid>)this["LibrarySortOrder"]);
      }
      set {
         this["LibrarySortOrder"] = value;
      }
    }

    ...
 }

When I save the settings to the file, I get the following XML (snippet)

<?xml version="1.0" encoding="utf-8"?>
<Settings>
    ...

    <LibrarySortOrder>
      <guid>4b11c0e0-6bf2-463a-b71c-b4704e4a67a6</guid>
    </LibrarySortOrder>
    ...
</Settings>

I have tried defining the [XmlArrayAttribute("LibrarySortOrder")], and [XmlArrayItem("guid")] for the LibrarySortOrder property, but it is always null on load. What am I missing here?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.