4
我正在尝试保存作为我的类的一种类型的对象的集合。我收到一个错误消息:Windows Phone 8 - 将列表保存到IsolatedStorage
集合数据合同类型System.Collections.Generic.List无法反序列化,因为它没有公共无参数构造函数。 添加公共无参数构造函数将修复此错误。
这里是我的类:
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()
{
}
}
}
这里是我如何保存到IsolatedStorage:
List<Lekarna> lekarneList = new List<Lekarna>();
// here I then fill the list ...
IsolatedStorageSettings localStorage = IsolatedStorageSettings.ApplicationSettings;
localStorage.Add("lekarneList", lekarneList;
localStorage.Save();
当我尝试像你已经完成的那样在孤立存储中保存列表,我明白了System.ArgumentException –