public static void SaveAppSetting(string configurationName, AppSetting setting) { lock (LockObject) { var configuration = LoadConfiguration(Settings.SettingsFilePath); var config = configuration[configurationName]; config.AddAppSetting(setting); SaveConfigurationInternal(configuration, Settings.SettingsFilePath); } }
public void AddAppSetting(AppSetting setting) { if (string.IsNullOrWhiteSpace(setting.Name)) throw new ArgumentNullException("Name must be specified."); AppSetting newSetting = GetAppSetting(setting.Name); if (newSetting == null) { newSetting = setting; _appSettings.Add(newSetting); } else newSetting.Value = setting.Value; }