C# 为什么';t XElement是否具有ToDictionary linq表达式?

C# 为什么';t XElement是否具有ToDictionary linq表达式?,c#,xml,linq,C#,Xml,Linq,由于某种原因,ToDictionary不起作用 我正在使用vs.NET2010和4.0 XElement root = XElement.Load(fullPathToXml); IEnumerable<XElement> nodes = root.Elements("root"); var dic = nodes.ToDictionary(...) XElement root=XElement.Load(fullPathToXml); IEnumerab

由于某种原因,ToDictionary不起作用

我正在使用vs.NET2010和4.0

XElement root = XElement.Load(fullPathToXml);            
IEnumerable<XElement> nodes = root.Elements("root");

var dic = nodes.ToDictionary(...)
XElement root=XElement.Load(fullPathToXml);
IEnumerable节点=根元素(“根”);
var dic=节点。ToDictionary(…)
我想把它转换成
字典

它说“ToDictionary”没有定义…?

添加

using System.Linq;

确切的错误是什么?