.Net 应用程序设置
我想实现应用程序设置,让它们更新不会在我管理的文件中设置的设置。到目前为止,我有以下内容:
在设置中,我有一个名为 valueforcomparison 类型 nameValueCollection 的变量,范围是用户。现在,当我执行以下操作时,变量在用户下次运行程序时不会更新。
public void UpdatePropertySettings(NameValueCollection settings)
{
Properties.Settings.Default.valuesforcomparison = new NameValueCollection();
for (int i = 0; i < settings.Count; i++)
{
Properties.Settings.Default.valuesforcomparison.Add(settings.GetKey(i), settings.GetValues(i)[0]);
}
Properties.Settings.Default.Save();
Properties.Settings.Default.Upgrade();
defVals = settings;
}
I want to implement application settings to have them update settings that wont be set in a file i manage. I have the following so far:
In settings I have a variable named valuesforcomparison of type nameValueCollection and the scope is user. Now when I do the following the variable isnt updated the next time the user runs the program.
public void UpdatePropertySettings(NameValueCollection settings)
{
Properties.Settings.Default.valuesforcomparison = new NameValueCollection();
for (int i = 0; i < settings.Count; i++)
{
Properties.Settings.Default.valuesforcomparison.Add(settings.GetKey(i), settings.GetValues(i)[0]);
}
Properties.Settings.Default.Save();
Properties.Settings.Default.Upgrade();
defVals = settings;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不支持 NameValueCollection。
NameValueCollection isnt supported.