المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : write to app.config through c#



C# Programming
03-12-2010, 03:50 PM
i found a code segment to write new name/value pairs to app.config, but it doesn't work properly. means it doesn't change the app.config file permanently.

following is the code segment

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add("name", t2.Text);
config.Save();
ConfigurationManager.*******Section("appSettings");


when i restart the program again only the default values are there .

any help,