.NET 应用程序/用户设置问题
有人可以向我解释一下应用程序和用户设置及其差异吗?我有一个只有一个人会使用的 C# 应用程序。用户可以在程序中设置一些首选项,我通过用户范围的设置实现了这些首选项。我的印象是用户范围的设置能够在运行时读取和写入,事实确实如此。但他们没有坚持。一旦应用程序关闭并重新打开,噗的一声,所有用户的设置都消失了。
应用程序设置似乎更适合我正在做的事情,只是它们不能在运行时进行操作。
那么...
问题#1:用户范围的设置是否应该持续存在?
问题#2:用户和应用程序范围之间的区别是否在于应用程序无法在运行时更改,但用户可以?
问题 #3:如果我无法使用设置,或者在这种情况下不应该使用设置,那么保存偏好设置的替代建议是什么?
Could someone please explain application and user settings, and their differences to me? I've got a C# application that only ONE person will use. There are preferences the user can set within the program, and I implemented these preferences with user-scoped settings. I was under the impression user-scoped settings would be able to be read and written at runtime, which they are. But they are not persisting. Once the application is closed and reopened, poof, there go all the user's settings.
Application settings seem to be a better fit for what I'm doing, except they can't be manipulated at runtime.
So...
Question #1: Are user-scoped settings suppose to persist?
Question #2: Is the difference between user and application scope the fact that application cannot be changed at runtime, but user can?
Question #3: If I can't use settings, or shouldn't in this case, what would alternative suggestions for saving preferences be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处提供了一些不错的信息。
Save()
函数!通常与Settings.Default.Save()
一起使用。There's some good information here.
Save()
function on them at some point! Usually withSettings.Default.Save()
.