クラスのタイプであるオブジェクトのコレクションを保存しようとしています。次のようなエラーが表示されます。
コレクション データ コントラクト型 '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();