Creatign new setting in userSettings section of app.config file
- From: "Andrus" <kobruleht2@xxxxxx>
- Date: Wed, 16 Jul 2008 20:54:18 +0300
..NET 2 Winforms application.
How to create new setting and set it default value in userSettings section of app.config file or overwrite existing setting value ?
I found code below in this list which modifies Application setting section but how to add new item to userSettings ?
Andrus.
string sPath = Path.Combine(Environment.CurrentDirectory, "myapp.exe");
Configuration config = ConfigurationManager.OpenExeConfiguration(sPath);
// If your <appSettings> section doesn't contain "test_key" you should add it
config.AppSettings.Settings.Add("test_key", "test_value");
config.AppSettings.Settings["test_key"].Value = "test_value";
config.Save(ConfigurationSaveMode.Modified);
.
- Prev by Date: Re: ternary operator and casting
- Next by Date: Re: revised : polymorphic object "against the grain" of C# ?
- Previous by thread: Passing struct of virtual functions
- Next by thread: Re: Creating new setting in userSettings section of app.config file
- Index(es):