use*_*636 2 c# linq html-agility-pack
我有以下 LINQ 在<tr>HTMLAgilityPack 的帮助下从 html 标签填充数据表,每个标签都有一个属性,innertext如果属性值为“ rating-col”,我需要忽略该标签的 。
nodes.Skip(1)
.Select(
tr => tr.Elements("td").
Select(td => td.InnerText.
Where(td.Attributes[0].Value != "rating-col")).
ToArray()).
ToList().
ForEach(row => dt.Rows.Add(row));
Run Code Online (Sandbox Code Playgroud)
如果没有Where子句,事情就可以正常工作,我在子句中做错了什么Where?
Where(td.Attributes[0].Value != "rating-col"))其中应该有一个 lambda ...例如:
Where(c => c.Attributes[0].Value != "rating-col"))
| 归档时间: |
|
| 查看次数: |
9183 次 |
| 最近记录: |