初学linq to xml,很方便
private string Sn; private string Name; private string icon; string path = ch.GetConfigFile("")+ "SpeedDial.xml"; var sdDoc = XDocument.Load(path); //linq to xml var query = from resource in sdDoc.Descendants("item") where (int)resource.Attribute("parentId") == 0 select new { Sn=resource.Element("sn").Value, Name=resource.Element("name").Value, Icon=resource.Element("icon").Value };