<p>I have a DataGridView that I want to query using Linq (C# WinForm). I want to "count" rows where a certain criteria is met. For example, </p>

<pre><code>variable1 = "count rows where ColumnBoxAge &gt; 3 || &lt; 5"

label1.Text = variable1
</code></pre>

<p>How to do this in C# WinForm using Linq?</p>

I don't know if it could work but you can try this;
```
```
dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>("ageColumn") > 3 ||
     c.Field<int>("ageColumn") < 5).Count();
```
```
Edit : Where instead of Select.