public void SetValues(string section, IReadOnlyList <SettingValue> values) { // machine wide settings cannot be changed. if (IsMachineWideSettings) { if (_next == null) { throw new InvalidOperationException(Resources.Error_NoWritableConfig); } _next.SetValues(section, values); return; } if (String.IsNullOrEmpty(section)) { throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, nameof(section)); } if (values == null) { throw new ArgumentNullException(nameof(values)); } var sectionElement = GetOrCreateSection(ConfigXDocument.Root, section); foreach (var value in values) { SetValueInternal(sectionElement, value.Key, value.Value, value.AdditionalData); } Save(); }
public void SetValues(string section, IList <KeyValuePair <string, string> > values) { // machine wide settings cannot be changed. if (IsMachineWideSettings) { if (_next == null) { throw new InvalidOperationException(Resources.Error_NoWritableConfig); } _next.SetValues(section, values); return; } if (String.IsNullOrEmpty(section)) { throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, "section"); } if (values == null) { throw new ArgumentNullException("values"); } var sectionElement = GetOrCreateSection(ConfigXDocument.Root, section); foreach (var kvp in values) { SetValueInternal(sectionElement, kvp.Key, kvp.Value); } Save(); }