.Net 应用程序设置

发布于 2024-09-15 03:53:57 字数 660 浏览 11 评论 0原文

我想实现应用程序设置,让它们更新不会在我管理的文件中设置的设置。到目前为止,我有以下内容:

在设置中,我有一个名为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔书几行 2024-09-22 03:53:57

不支持 NameValueCollection。

NameValueCollection isnt supported.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文