how do you add a condition to a lambda expression

Posted by ooo on Stack Overflow See other posts from Stack Overflow or by ooo
Published on 2010-06-07T10:44:07Z Indexed on 2010/06/07 10:52 UTC
Read the original article Hit count: 246

Filed under:
|
|

if i have this code today to find out a sum total using LINQ:

return (MyArray.Sum(r => r.Trips);

and i want to only include itms where r.CanDrive == true.

can you add a condition into a single linke lambda expression? how would you do this

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ