Search code examples
c#windows-8roaming

What attribute do I need to save to RoamingSettings?


What attribute do I need to save to RoamingSettings?

Like when I serialize my data, it needs a DataContract and DataMember attributes. I can serialize my class to XML, but I need to save it with RoamingSettings:

roamingSettings.Values["MyType"] = _mytype;

While debugging, I get this error message:

Data of this type is not supported.
WinRT information: Error trying to serialize the value to be written to the application data store

I guess I need an attribute, but which one?


Solution

  • Best way to handle this situation, is to serialize the object into string and store it.

    Deserialize from the stored string value into target object.