XML:
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
...
<author>
<name>Seamless</name>
<uri>https://gdata.youtube.com/feeds/api/users/SeamlessR</uri>
</author>
代码:
var ns = XNamespace.Get("http://www.w3.org/2005/Atom");
var name = xDoc.Descendants(ns + "entry").First().Element("author").Element("name").Value;
它说Object reference not set to an instance of an object.