ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
localSettings.Values["stupidcrap"] = "test1";
然后在 Visual Studio 中重新启动应用程序后:
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
Debug.WriteLine(localSettings.Values["stupidcrap"]);
它什么也不打印(这意味着 Object 为空)。
为什么会这样?
当我这样做时:
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
localSettings.Values["stupidcrap"] = "test1";
Debug.WriteLine(localSettings.Values["stupidcrap"]);
它打印成功,但存储点是重新启动应用程序后保存的值可用....
为什么内存/存储/任何东西都不能保存我的值?