title: Get all <img> elements on a webpage
body: <p>Hey guys I was wondering how to get all  elements with C# on a webpage. I was using this code below:</p>
  
  <pre><code>HtmlElementCollection collection = web.Document.GetElementsByTagName("img");
  
  foreach(HtmlElement element in collection) {
    //do my stuff with iterations
  }
  </code></pre>
  
  <p>However that code pops up with this error:</p>
  
  <pre><code>Specified cast is not valid.
  </code></pre>
  
  <p>How would I go about doing this properly?</p>