Query expression to count number of items which matches the condition using LINQ

Amatya
Posted by Amatya under LINQ category on | Points: 40 | Views : 322
Query expression to count number of items which matches the condition using LINQ
IEnumerable<int> dnfItems = new List<int> { 10, 20, 30, 40, 50, 60, 70 };
int dnfCount = (from dnf in dnfItems where dnf < 50 select dnf).Count();


Result
dnfCount 4

Comments or Responses

Login to post response