I think if you're using appSettings
, it's perfectly fine, unless you expect the complexity or amount of data to get unwieldy. For a simple, small, mostly static lookup, I think it's ok.
As to your issue of not being able to save the values back to the config, you need to use ConfigurationManager.OpenExeConfiguration
:
Configuration config =
ConfigurationManager.OpenExeConfiguration("app.config");
string categories = ConfigurationManager.AppSettings.Get("categories");
config.AppSettings.Remove("categories");
config.AppSettings.Add("categories", categories + ";Test");
config.Save(ConfigurationSaveMode.Modified);
If you will have lots of complicated settings per user, then this approach isn't likely the best one. If a database isn't an option, you can just use a separate XML config file and load it / update it via XmlSerializer
or XLinq
.