我嘗試過在Google上搜索並在這裏找不到任何好東西。任何幫助,將不勝感激。將對象保存到IsolatedStorageSettings.ApplicationSetting時出現「不支持多維數組」錯誤
無論我嘗試將我自己的對象添加到用戶設置中,應用程序都會崩潰。 Game類非常簡單,有一些字符串和int屬性。如果其相關我可以更新該職位的全部細節。
無論何時設置CurrentGame1的值,它都會在保存方法上出現錯誤「不支持多維數組」的保存方法。我需要序列化對象嗎?我寧可不要的併發症,如果我能避免它
private Game CurrentGame1
{
get
{
if (IsolatedStorageSettings.ApplicationSettings.SingleOrDefault(z => z.Key == "Game1").Key == null) {
IsolatedStorageSettings.ApplicationSettings.Add("Game1", new Game());
IsolatedStorageSettings.ApplicationSettings.Save();
}
return IsolatedStorageSettings.ApplicationSettings["Game1"] as Game;
}
set
{
IsolatedStorageSettings.ApplicationSettings.Remove("Game1");
IsolatedStorageSettings.ApplicationSettings.Add("Game1", value);
IsolatedStorageSettings.ApplicationSettings.Save();
}
}
這裏的相關代碼是Game類 - 這是大概定義了一個不能自動序列化的多維數組的地方 – 2011-04-03 20:19:54