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