Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Replacing foreach loop with LINQ

, 22 Oct 2011
Rate this:
Please Sign up or sign in to vote.
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)

About the Author

George Swan
Student
Wales Wales
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 2 Possible but (to some of us) not pre... Pinmemberdmjm-h1-Nov-11 5:40 
GeneralReason for my vote of 4 Optimized the code and reduced the e... PinmemberRags151222-Oct-11 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 22 Oct 2011
Article Copyright 2011 by George Swan
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid