我对linq有问题,我想从youtube xml中获得乘法结果,但是这段代码仅给我一个结果,有人知道如何解决此问题?
key = @"http://gdata.youtube.com/feeds/api/videos?q="+keys+@"&orderby=relevance";
var youtube = XDocument.Load(key);
var urls = (from item in youtube.Elements("{http://www.w3.org/2005/Atom}feed")
select new
{
soundName = item.Element("{http://www.w3.org/2005/Atom}entry").Element("{http://www.w3.org/2005/Atom}title").ToString(),
url = item.Element("{http://www.w3.org/2005/Atom}entry").Element("{http://www.w3.org/2005/Atom}id").ToString(),
});
youtube xml:
http://gdata.youtube.com/feeds/api/videos?q=keyword&orderby=relevance
感谢帮助!
最佳答案
var urls = (from item in youtube.Element("{http://www.w3.org/2005/Atom}feed").Descendants("{http://www.w3.org/2005/Atom}entry")
select new
{
soundName = item.Element("{http://www.w3.org/2005/Atom}title").ToString(),
url = item.Element("{http://www.w3.org/2005/Atom}id").ToString(),
});
关于c# - 通过linq获取乘法结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20031912/