.NET supports several ways to store configuration settings for quite some time, which has led to a lot of confusion. It doesn’t help that the three best hits for searching “Settings in C #” on MSDN are ten years (and many of the related questions [2] on this venerable site are also 6-7 years old). It is very difficult to determine which of the early recommendations was since outdated.
In my project, I decided to use ApplicationSettings(as opposed to AppSettings) because:
However, now I need to decide where to place the connection strings. The latest documentation on MSDN (and here, on SO , and also since CP ) still recommends using the section <connectionStrings> app.config. But accessing this from code requires the use of the old syntax, which I now consider deprecated with appSettings. In other words, it makes no sense to read one part of the file app.configwith the old syntax:
ConfigurationManager.ConnectionStrings["MydDBConnName"];
and another part of the same file with the new syntax :
Properties.Settings.Default.myOtherSetting;
Also, this prevents me from editing lines in the designer.
So bottom line: is there any reason not to standardize all my configuration settings (including connection strings) in an element ApplicationSettings?