M
Mark
..Net framework 2.0
I've read up on persisting user settings. As I understand it, the
app.config file contains both the application and user settings when
the app is first installed. A user then makes a change in the app that
is one of the user settings in app.config and I wish to persist this,
so I call the Save() method. This works fine.
However, I've noticed that only settings that have been written to are
"copied" to the user.config file when the Save() method is called.
Given that not all users have direct (file system) access to the
app.config file and are supposed to use their own user.config file, I
was surprised because I then wondered how they are supposed to even
know that some of the settings exist (those that they happened not to
change). Then I wondered if I'd misunderstood something fundamental
here: are users not supposed to be opening up their user.config files
in, say, notepad to see what settings exist? I'm now getting the
impression that it was never MS's intention that users would go into
their own config files directly, but I can't see any articles that
state that. (One hack is simply to assign all the settings to
themselves in code and then call Save(), which effecitvely "copies"
all the user settings in app.config to user.config. This works, but
I'm now wondering if I have a concept problem here!) Personally, I
can't see why we should tell users about their own user.config files.
After all, the whole point of the Settings class is to ensure that if
they enter gobbldygook into it, Settings will simply put things back
to default.
Any thoughts?
I've read up on persisting user settings. As I understand it, the
app.config file contains both the application and user settings when
the app is first installed. A user then makes a change in the app that
is one of the user settings in app.config and I wish to persist this,
so I call the Save() method. This works fine.
However, I've noticed that only settings that have been written to are
"copied" to the user.config file when the Save() method is called.
Given that not all users have direct (file system) access to the
app.config file and are supposed to use their own user.config file, I
was surprised because I then wondered how they are supposed to even
know that some of the settings exist (those that they happened not to
change). Then I wondered if I'd misunderstood something fundamental
here: are users not supposed to be opening up their user.config files
in, say, notepad to see what settings exist? I'm now getting the
impression that it was never MS's intention that users would go into
their own config files directly, but I can't see any articles that
state that. (One hack is simply to assign all the settings to
themselves in code and then call Save(), which effecitvely "copies"
all the user settings in app.config to user.config. This works, but
I'm now wondering if I have a concept problem here!) Personally, I
can't see why we should tell users about their own user.config files.
After all, the whole point of the Settings class is to ensure that if
they enter gobbldygook into it, Settings will simply put things back
to default.
Any thoughts?