C# Windows Phone 8-将列表保存到IsolatedStorage
我正在尝试保存属于类类型的对象集合。我得到一个错误声明: 无法反序列化集合数据协定类型“System.Collections.Generic.List”,因为它没有公共无参数构造函数。 添加公共无参数构造函数将修复此错误 这是我的班级:C# Windows Phone 8-将列表保存到IsolatedStorage,c#,silverlight,windows-phone-8,windows-phone,C#,Silverlight,Windows Phone 8,Windows Phone,我正在尝试保存属于类类型的对象集合。我得到一个错误声明: 无法反序列化集合数据协定类型“System.Collections.Generic.List”,因为它没有公共无参数构造函数。 添加公共无参数构造函数将修复此错误 这是我的班级: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MojPr
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()
{
}
}
}
下面是我如何保存到隔离存储的方法:
List<Lekarna> lekarneList = new List<Lekarna>();
// here I then fill the list ...
IsolatedStorageSettings localStorage = IsolatedStorageSettings.ApplicationSettings;
localStorage.Add("lekarneList", lekarneList;
localStorage.Save();
List-lekarneList=newlist();
//然后我在这里填写清单。。。
IsolatedStorageSettings localStorage=IsolatedStorageSettings.ApplicationSettings;
添加(“lekarneList”,lekarneList;
localStorage.Save();
公开课堂
公共类Lekarna
当我尝试像您一样将列表保存在isolatedstorage中时,我得到System.ArgumentException