public void Delete(string id) {
var fileName = Request.MapPath(DATA_FILE_PATH);
var xml = XDocument.Load(fileName);
var result = from item in xml.Descendants("item")
where (string)item.Element("id") == id
select item;
foreach(var item in result.ToList()) item.Remove();
xml.Save(fileName);
}
2008年11月22日土曜日
LINQ to XML でノード削除する。
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿