public bool DeleteValue(string section, string key) { // machine wide settings cannot be changed. if (IsMachineWideSettings) { if (_next == null) { throw new InvalidOperationException(Resources.Error_NoWritableConfig); } return(_next.DeleteValue(section, key)); } if (String.IsNullOrEmpty(section)) { throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, nameof(section)); } if (String.IsNullOrEmpty(key)) { throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, nameof(key)); } var sectionElement = GetSection(ConfigXDocument.Root, section); if (sectionElement == null) { return(false); } var elementToDelete = FindElementByKey(sectionElement, key, null); if (elementToDelete == null) { return(false); } XElementUtility.RemoveIndented(elementToDelete); Save(); return(true); }