且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用HTML Agility Pack选择所有以特定文本值开头的段落

更新时间:2023-11-26 19:17:22

您可以获取前5个段落,其中内部文本以"Version"开头.像这样:

You can get the first 5 paragraphs where the inner text starts with "Version" like this:

var nodesParagraph = nodeRevHist
    .Elements("p")
    .Where(p => p.InnerText.Trim().StartsWith("Version"))
    .Take(5);

在此处工作的演示: https://dotnetfiddle.net/uvwcUN