Windows Phone 8 - Saving a List in IsolatedStorage

I am trying to save a collection of objects that are a type of my class. I get an error message:

The data collection contract type "System.Collections.Generic.List cannot be deserialized because it does not have an open constructor without parameters. Adding an open constructor without parameters will fix this error.

Here is my class:

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MojProjekt { class Lekarna { public string Ime { get; set; } public Lekarna() { } } } 

And here is how I can save on IsolStorage:

 List<Lekarna> lekarneList = new List<Lekarna>(); // here I then fill the list ... IsolatedStorageSettings localStorage = IsolatedStorageSettings.ApplicationSettings; localStorage.Add("lekarneList", lekarneList; localStorage.Save(); 
+4
source share
1 answer

make the class public

public class Lekarna

+6
source

Source: https://habr.com/ru/post/1495474/


All Articles