我在运行时保存应用程序设置时遇到了一些问题...
如果我将设置范围更改为用户,它可以正常工作,但在应用程序范围内,什么也没有发生......
我用过:
Properties.Settings.Default.Save();
有任何想法吗 ?
谢谢
最佳答案
那是因为将范围设置为 Application 使其成为只读的。
见 Using Settings in C#
Application-scope settings are read only, and can only be changed at design time or by altering the .exe.config file in between application sessions. User-scope settings, however, can be written at run time, just as you would change any property value. The new value persists for the duration of the application session. You can persist changes to user settings between application sessions by calling the Settings.Save method.
关于winforms - winform 的应用程序设置 : cannot save application settings which has been added during the run time,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9617236/