private void DelSaveUser(object[] x) { Button Btn = x[0] as Button; int _index = JObjectHelper.GetStrNum(Btn.Tag.ToString()) - 1; string UserPhone = LocalUserInfo[_index].Phone; LocalUserInfo.RemoveAt(_index); //删除本地用户 XElement xele = XElement.Load(Path.Combine(localUserInfoFilepath, FileName)); //MessageBox.Show(xele.Element("Phone").Value) var item = (from ele in xele.Elements("User") where (string)ele.Element("Phone") == UserPhone select ele).FirstOrDefault(); if (item != null) { item.Remove(); } xele.Save(Path.Combine(localUserInfoFilepath, FileName)); sort(); }