c# - 我是否需要在 Windows Phone 应用程序中调用 IsolatedStorageSettings.Save 方法?

标签 c# .net windows-phone-7 application-settings

来自IsolatedStorageSettings.Save Method的备注部分页:

Data written to the IsolatedStorageSettings object is saved when the application that uses the class is closed. This can occur when the user closes the Web browser, refreshes a page, or browses away from the page. If you want your application to write to isolated storage immediately, you can call the Save method in application code.

因此,我永远无法调用Save 方法,并且每个设置都是安全的。我只是好奇我应该在哪些用例中使用 Save 方法?

最佳答案

您必须自己调用 IsolatedStorageSettings.Save。正如 class reference page 底部的“提示和警告”部分所述,您必须自己保存它以确保它已写入文件。

The IsolatedStorageSettings class is not automatically saved to disk when values are written. Saves are done in a finalizer, which is usually but not always run when the application shuts down. To ensure saves are actually performed we need to call the Save method after each write or set of writes.

关于c# - 我是否需要在 Windows Phone 应用程序中调用 IsolatedStorageSettings.Save 方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13234131/

相关文章:

c# - 获取上下文菜单的控制权

c# - LockablePivot 抛出 InvalidCastException

c# - 使用 GET 执行 WebRequest 时出现 ProtocolViolationException

c# - 非静态字段、方法或属性(数据集)需要对象引用

c# - 合并两个相同的 ASP.NET 网站的最佳方式?

.net - 消息(不是异常)应如何从模型/业务对象层传递到UI?

windows-phone-7 - OnBackKeyPress 转到页面的另一个实例

c# - 碰撞取决于矩形的边?

c# - MVVM? mvvmc?还是我做错了?

c# - 按钮点击不起作用