title: How to convert Foreach loop to Linq (in datagridview)
body: <pre><code>foreach (GridViewRow row in gridView.Rows)
  { // Access the CheckBox 
      CheckBox cb = (CheckBox)row.FindControl("SuburbSelector");
      if (cb.Checked)
      {
          //do something;
      }
  }
  </code></pre>
  
  <p>I tried the following and got error</p>
  
  <p>Linq: </p>
  
  <pre><code>var Str = SuburbGridView.Rows.Cast&lt;GridViewRow&gt;().Where(r=&gt;(CheckBox)r.FindControl("SuburbSelector")==checked);
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Delegate 'System.Func &lt; System.Web.UI.WebControls.GridViewRow,int,bool>' does not take 1 arguments</p>
  </blockquote>
  
  <p>Many thanks</p>