为了测试我的漫游和/或本地设置,我希望能够清除所有设置。
我可以这样做,我猜:
App.roamingSettings.Value["SomeVal"] = string.Empty;
App.roamingSettings.Value["SomeOtherVal"] = string.Empty;
App.roamingSettings.Value["YetAnotherVal"] = string.Empty;
...
etc.
...但我宁愿有一些更快,更清洁(没有双关语)的方式。有吗?
此外,与此相关的是,如果有一个“设置管理器”实用程序可以快速验证它们是否也是您认为的那样,那将是一件好事。有人知道吗?
更新
这是我根据答案“自己动手”的尝试;到目前为止,没有去:
string roamingSettingPairs = string.Empty;
for (int i = 0; i < App.roamingSettings.Values.Count; i++)
{
// Print out whatever you want to verify that everything is as it should be
//string roamingSettingName = App.roamingSettings.Name[i].ToString();
//string roamingSettingValue = App.roamingSettings.Values[i].ToString();
Dictionary<string, object> roamingSettingVals = App.roamingSettings.Values;
string roamingSettingName = roamingSettingVals.Keys[i];
object roamingSettingObj = roamingSettingVals.Values[i];
//roamingSettingPairs = string.Format("{0}{1}={2}{3}", roamingSettingPairs, roamingSettingName,
// roamingSettingValue, Environment.NewLine);
}