c# - Calling method with linq syntax based on condition -


how loop through generic list , call method based on couple of conditions? i'd use linq syntax. following doesn't work of course. ideas?

somelist.foreach(i => i.depttype == 1 && != null () {mymethod(someint)}); 

if isn't possible, next best method using concise syntax?

try using specify records want select , foreach execute method:

somelist.where(i => i.depttype == 1 && != null)            .tolist()            .foreach( i=> mymethod(i.someint)); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -