Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Application/User Settings Issues

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?

like image 939
CODe Avatar asked Aug 17 '26 01:08

CODe


1 Answers

There's some good information here.

  1. Yes. Make sure you're calling the Save() function on them at some point! Usually with Settings.Default.Save().
  2. Yes, but no. I believe that technically you can change and persist application settings at runtime, but not really because most deployment mechanisms prevent this because your installation folder should be read only.
  3. N/A. Use the settings! You're on the right track. If you find you need to persist loads of information then you might need to look at richer data stores - e.g. XML, SQL, SQL-CE, etc.
like image 173
Reddog Avatar answered Aug 18 '26 15:08

Reddog



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!