title: How to count the number of elements that match a condition with LINQ
body: <p>I've tried a lot of things but the most logical one for me seems this one:</p>
  
  <pre><code>int divisor = AllMyControls.Take(p =&gt; p.IsActiveUserControlChecked).Count();
  </code></pre>
  
  <p><code>AllMyControls</code> is a Collection of <code>UserControls</code>, what I want to know is how many <code>UserControls</code> have the <code>IsActiveUserControlChecked</code> property set to true.</p>
  
  <p>What I get in VS is:</p>
  
  <pre><code>Cannot convert lambda expression to type 'int' because it is not a delegate type
  </code></pre>
  
  <p>What's wrong with my expression?</p>