应该很简单,但是今天早上的咖啡就是不起作用。
<root>
<Mappings>
<Map key="foo" value="bar" />
</Mappings>
</root>
internal bool MappingExists(KeyValuePair<string,string> targetMap)
{
XDocumnet _doc = XDocument.Load(foo.xml)
var x = //Insert Linq Here?
}检查Map Node是否有与我的字典中的键相同的键的linq语句是什么?
发布于 2011-02-23 01:54:18
var x = from mapElement in doc.Root.Element("Mappings").Elements("Map")
let keyAttr = map.Attribute("key")
where keyAttr != null && keyAttr.Value = targetMap.Key
select mapElement;
return x.Any();https://stackoverflow.com/questions/5081309
复制相似问题