using System.Configuration;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings[ " defaultPath " ].Value = value; config.Save(); ConfigurationManager.RefreshSection( " appSettings " );