Query expression to count items in the collection using LINQ

Amatya
Posted by Amatya under LINQ category on | Points: 40 | Views : 141
Query expression to count items in the collection using LINQ

IEnumerable<int> dnfItems = new List<int> { 100, 200, 300 };
int dnfCount = (from dnf in dnfItems select dnf).Count();


Result
dnfCount 3

Comments or Responses

Login to post response