节点阵列上的c#HtmlAlityPack

节点阵列上的c#HtmlAlityPack,c#,html,arrays,html-agility-pack,C#,Html,Arrays,Html Agility Pack,我正在使用html agility pack,在获得节点数组后: HtmlNode[] nodes = document.DocumentNode.SelectNodes("//tbody[@class='table']").ToArray(); 现在,我想为每个节点运行一个for循环[i]。我试过这个: for (int i = 0; i < 1; i++) { if (t == null)

我正在使用html agility pack,在获得节点数组后:

HtmlNode[] nodes = document.DocumentNode.SelectNodes("//tbody[@class='table']").ToArray();
现在,我想为每个节点运行一个for循环[i]。我试过这个:

 for (int i = 0; i < 1; i++)
            {

                if (t == null)
                    t = new Model.Track();

                 HtmlNode[] itemText = nodes[i].SelectNodes("//td[@class='artist']").ToArray();

                for (int x = 0; x < itemText.Length; x++)
                { //doing something      }
for(int i=0;i<1;i++)
{
如果(t==null)
t=新模型。轨迹();
HtmlNode[]itemText=nodes[i]。选择nodes(“//td[@class='artist']”)。ToArray();
对于(int x=0;x
问题是itemtext数组没有关注节点[i]。 但会在html文档中显示所有(“//td[@class='artist']”)的数组。
帮助?

使用
//td[@class='artist']
将从您的
文档中使用
artist
类获取所有列。DocumentNode


使用
//td[@class='artist']
(注意开头的点)将从当前选定的节点获取所有带有
artist
类的列,在您的情况下,这些节点是
节点[i]

,您可以共享通过此链接或html获取的链接吗?我已经从zroq获得了正确的答案,谢谢。