I have an app that loads webcomic images into a FlipView and I would like to save this in page state, however I seem to have run into some trouble with saving a List into LocalSettings. Is there a way for me to serialize this data so that I could save the state of my FlipView? Here's the code for Comic:
public class Comic
{
public int Month { get; set; }
public int Num { get; set; }
public string Link { get; set; }
public int Year { get; set; }
public string News { get; set; }
public string Safe_Title { get; set; }
public string Transcript { get; set; }
public string Alt { get; set; }
public string Img { get; set; }
public string Title { get; set; }
public int Day { get; set; }
public Comic() { }
}
Each element in LocalSettings has to be a supported Window Runtime type so you can't save the class instance itself, but you can create a composite value and set the individual properties. Take a look at the code sample for ApplicationDataCompositeValue
Alternatively, you could serialize to JSON and store as a single string (if < 8K total) or use a file in LocalFolder versus LocalSettings.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.