Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Windows Phone 8-将列表保存到IsolatedStorage_C#_Silverlight_Windows Phone 8_Windows Phone - Fatal编程技术网

C# Windows Phone 8-将列表保存到IsolatedStorage

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

我正在尝试保存属于类类型的对象集合。我得到一个错误声明:

无法反序列化集合数据协定类型“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()
        {
        }
    }
}
下面是我如何保存到隔离存储的方法:

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