HTML源代码如下所示获得通过LINQ
<img id="itemImage" src="https://www.xyz.com/item1.jpg">
我使用下面的LINQ查询来获取SRC值(图片链接)
string imageURL = document.DocumentNode.Descendants("img")
.Where(node => node.Attributes["id"] != null && node.Attributes["id"].Value == "itemImage")
.Select(node => node.Attributes["src"].Value).ToString();
但IMAGEURL给输出
System.Linq.Enumerable+WhereSelectEnumerableIterator`2[HtmlAgilityPack.HtmlNode,System.String]