public void RemoveSetting(string name) { XElement element = null; foreach (var xl in XMLLuaSettings.Elements(SettingConstants.SettingKeys.Set)) { if (xl.Element(SettingConstants.SettingKeys.SetName).Value.Contains(name)) { element = xl; break; } } if (element != null) { element.Remove(); } if (LuaSettings.ContainsKey(name)) { LuaSettings.Remove(name); } }