Pardon my ignorance, but I've never really developed windows apps. How do you store user settings? Is an embedded database the preferred method?
views:
261answers:
6I think you are looking for user settings:
The .NET Framework 2.0 allows you to create and access values that are persisted between application execution sessions. These values are called settings. Settings can represent user preferences, or valuable information the application needs to use. For example, you might create a series of settings that store user preferences for the color scheme of an application. Or you might store the connection string that specifies a database that your application uses. Settings allow you to both persist information that is critical to the application outside of the code, and to create profiles that store the preferences of individual users.
You should read this: http://msdn.microsoft.com/en-us/library/aa730869(VS.80).aspx
It depends on what kind of settings. There are a variety of methods from embedded databases (like SQLite) to XML files, to the Registry.
- If the settings are very few, the registry often makes sense.
- If the settings are more complicated, and need to be hand edited, you can use XML files or JSON.
- If the settings are complex and do not need hand editing, an embedded database like SQLite, .NetBtree, or BerkelyDB .NET are good choices.
It all depends what size of a application you are building. I you are on something simple, let's say, "family shopping list", you can store setting in good old plain text file.
If you are building something bigger, for example a "classmate notifier" you can use XML file, or some kind other resource.
For any bigger application you should use some kind of relational database, for storing user data.
Use Blane's Pegasus Library (http://pegasus.codeplex.com/).
You could use his XmlSerializationHelper class which makes it a snap to turn objects into XML and vice versa.
Or you could use Isolated Storage (I would provide a link to MSDN if I wasn't a new user and restricted to one hyperlink per post). If you use IsolatedStorage, consider using Blane's IsolatedStorageHashtable class.