title: htmlAgilityPack parse table to datatable or array
body: <p>I have these tables:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tbody&gt;
  &lt;tr&gt;&lt;th&gt;Header 1&lt;/th&gt;&lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;table&gt;
  &lt;tbody&gt;
  &lt;tr&gt;
  &lt;th&gt;Header 1&lt;/th&gt;
  &lt;th&gt;Header 2&lt;/th&gt;
  &lt;th&gt;Header 3&lt;/th&gt;
  &lt;th&gt;Header 4&lt;/th&gt;
  &lt;th&gt;Header 5&lt;/th&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  &lt;td&gt;text 1&lt;/td&gt;
  &lt;td&gt;text 2&lt;/td&gt;
  &lt;td&gt;text 3&lt;/td&gt;
  &lt;td&gt;text 4&lt;/td&gt;
  &lt;td&gt;text 5&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I am trying to transform into an array or List using this code:</p>
  
  <pre><code>var query = from table in doc.DocumentNode.SelectNodes("//table").Cast&lt;HtmlNode&gt;()
                           from row in table.SelectNodes("tr").Cast&lt;HtmlNode&gt;()
                           from header in row.SelectNodes("th").Cast&lt;HtmlNode&gt;()
                           from cell in row.SelectNodes("td").Cast&lt;HtmlNode&gt;()
                           select new { 
                               Table = table.Id, 
                               Row = row.InnerText, 
                               Header = header.InnerText,
                               CellText = cell.InnerText
                           };
  </code></pre>
  
  <p>But it doesn't work. What is wrong?</p>