Filtering a list of HtmlElements based on a list of partial ids

后端 未结 1 647
深忆病人
深忆病人 2021-01-15 20:00

I\'ve got an HtmlElementCollection and I want to use Linq to get a list of HtmlElements whose ids contain an id from another list.

So I\'ve tried a couple of things

相关标签:
1条回答
  • 2021-01-15 20:30

    so something like elems.Where(x => ids.Any(id => x.ID.Contains(id)))

    What this is doing is going through each item in elems (your html element list) and then going through each id in your id collection and if any match, then it will return that element.

    0 讨论(0)
提交回复
热议问题