XDocument.Root.Element返回null

我有XML就像:

  false some matrix ...Some more nodes...  

和代码是这样的:

 var doc = XDocument.Parse(myXmlString); Console.WriteLine(doc.Root.Element("Name")); 

和控制台只显示一个空格,因为doc.Root.Element("Name")返回null =(

虽然我可以在doc.Root.Elements()结果中找到这个元素。 doc.Root.Attribute("MyAttribute")给出了正确的结果。

它/我有什么问题?

元素位于mylink命名空间中:

 XNamespace mylink = "mylink"; Console.WriteLine(doc.Root.Element(mylink + "Name"));