I’m predominantly a C# .NET 4.0 developer, and right now I’m reconsidering past approaches to storing and retrieving application settings.
In the past I’ve used a variety of methods, from simple ‘flat’ text files with tab separated key/values, to layered XML files, and a few other things in between. I’ve used in the past ( and am considering using again ) the built in App.Config/AppSettings classes, but there isn’t any built in way to save data that you’ve loaded in from this source ( I could go into the difficulties I’m having in doing this but that’s not the point of the question ).
The point here, is that all of these methods have their shortcomings, and while some work better than others, some are simpler to employ than others, and I am trying to nail down something that will be consistent and reliable.
My question, which will likely have a few valid answers so I’ll be forced to pick the best one, is this: What if any built-in framework would ‘you’ recommend for both saving and loading data in and out of a settings file that can accompany the executable, or if not a built in framework, what standard would you recommend? XML? ‘Flat’ files? Stand-Alone Database?
Assume that the configuration itself won’t be that large, and any real quantity of data will be read from a database ( or using some other technology ).
While Im a registry fan, and would rather have my settings there, with my c# apps I’ve used the settings that come built in – so under project properties you can define a load, and their default values, and then access them with
and can set them too, so
Properties.Settings.Default.HideDisabled = true;and you can save them with
Ive not had issues with this, but then, as you said, everything has a pro and a con.