The other problem with this default solution is it only supports a single large flat file model of preferences. Since VS provides visual tools for creating a strongly typed dataset, which can be mated to an .xml file, that seems like a much better way to store preferences. With the .xsd approach you can create a hierarchal relationship between data tables and create many to one relationships which makes storing preferences for multiple related objects much easier. It's a little more work to set up but in the long run pays more benefits. You can even leverage LINQ to query your settings. It is also fully supported by data binding. In fact, once you set it up you'll find yourself adding tables for drop down lists and other constant data, so that you can easily data bind to it. Plus you most likely won't write code that hides the .xml file requiring your user's to partake in a scavenger hunt if they want to preserve their settings between releases. You'll probably just store your preferences file right there in the same folder with your application data. Just think not only will it be easy to find, it will be easy to back up, move, replace and even change with a text editor.
Dec 6, 2008
- Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.