Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Replacing foreach loop with LINQ

4.38/5 (5 votes)
22 Oct 2011CPOL 15.3K  
Isn't it possible to remove the from and select statements by using a lambda expression?var bestStudents=students.Where(s=>s.Grade>9);
Isn't it possible to remove the from and select statements by using a lambda expression?
var bestStudents=students.Where(s=>s.Grade>9);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)