public void SetNestedValues(string section, string key, IList <KeyValuePair <string, string> > values) { // machine wide settings cannot be changed. if (IsMachineWideSettings) { if (_next == null) { throw new InvalidOperationException(Resources.Error_NoWritableConfig); } _next.SetNestedValues(section, key, 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, key); foreach (var kvp in values) { SetValueInternal(element, kvp.Key, kvp.Value, attributes: null); } Save(); }