Reputation: 2385
I am trying to save a collection of object that are a type of my class. I get an error stating:
The collection data contract type 'System.Collections.Generic.List cannot be deserialized because it does not have a public parameterless constructor. Adding a public parameterless constructor 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 save to the IsolatedStorage:
List<Lekarna> lekarneList = new List<Lekarna>();
// here I then fill the list ...
IsolatedStorageSettings localStorage = IsolatedStorageSettings.ApplicationSettings;
localStorage.Add("lekarneList", lekarneList;
localStorage.Save();
Upvotes: 4
Views: 3087