private void GetMenuNode(bool isAdd, XmlDocument xmlMenu, string AddPath, string ModifyPath, ref XmlElement xnNew) { XmlNodeList xmlList = xmlMenu.SelectNodes(isAdd == true? AddPath : ModifyPath); foreach (XmlNode xn in xmlList) { DMenu xnMenu = DMenu.NodeToMenu(xn, MenuTypeEnum.Menu, ""); if (isAdd) { if (xnMenu.Guid == _saveMenu.ParentGuid) { xn.AppendChild(xnNew); break; } } else { if (xnMenu.Guid == _saveMenu.Guid) { xnNew = xn as XmlElement; break; } } } }