【问题标题】:C# Settings Rembering SettingsC# 设置重新设置
【发布时间】:2009-02-06 00:57:11
【问题描述】:

如何让我的程序记住用户设置?

【问题讨论】:

    标签: c# settings


    【解决方案1】:

    您可以:

    • 将设置写入文件
    • 在 VS 中使用 Project->Properties->Settings... 创建设置,然后使用

      Properties.Settings.Default.SettingName = "something"; // 设置设置

      this.Text = Properties.Settings.Default.SettingName; // 使用设置

    【讨论】:

    • 如果您希望设置在应用程序会话之间保持不变,那么您还需要保存它们:Properties.Settings.Default.Save();
    【解决方案2】:

    您似乎在寻找UserScopedSettingAttribute

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-02
      • 1970-01-01
      • 1970-01-01
      • 2023-01-19
      • 2013-06-08
      • 1970-01-01
      • 2010-11-26
      相关资源
      最近更新 更多