Hi Richard,
Settings file? I saw that but was under the impression that it did not
lend itself well to addition and deletion of values programmatically. Did
I misunderstand? Because I thought that it would be difficult to write
user specific application options and MRU list, I deemed that approach
unreasonable. Have I unnecessarily exercised myself in jumping to this
conclusion?
Yes :)
Take a look at the article I posted and you'll see that even controls can
use the Application Settings architecture. For example, ToolStrip uses
Application Settings to save position information of itself and its items
between application sessions.
The ApplicationSettingsBase class provides a Save method that you can call
from your application to persist data (the Save method is actually an
overridden form of the SettingsBase.Save method, from which it derives).
You can even create your own SettingsProvider for persistence outside of the
default local file storage.
Particular settings may be configured to have application-scope or
user-scope in WinForms applications and there is built-in support for
collections as well. IMO, this technology is perfect for persisting a raw
MRU list, per user, as long as the information being persisted isn't
sensitive data that must be secured (although simple, managed cryptography
would probably do the trick).
Given that writing an indeterminate number of user specific values to some
sort of persistent storage is such a common requirement, one would have
thought that a consensus as to best practice would have been developed for
which I, only recently having been prized kicking and screaming from the
MFC dark ages, was unaware. I do thank you all for your patience while I
flail randomly about as I try to come up to speed.
There are no explicitly stated "best practices" that I'm aware of since you
have to consider security, the quantity of the data and the type of the data
(e.g., relational, structured, raw text, raw binary) and because there are
many different places and ways to persist the data (e.g., Application
Settings, application configuration file, Isolated Storage, delimited
flat-file, RDBMS, structured storage, xml file, raw binary file containing a
serialized object-graph, etc.). Application Settings, in the 2.0 framework,
is usually sufficient, but I've seen applications use Isolated Storage, the
application configuration file, an xml file or an RDBMS such as Sql Server
2005 as well.
--
Dave Sexton