views:

48

answers:

1

I am setting two values based on two different conditions inside for each. Is it possible to implement the below in LINQ ?

foreach(Customer cust in Customers)
{
    If(Condition 1)
            condtion1Var =true;
    If(Condition2 )
            condition2Var =true;
}
+2  A: 
condition1Result = customers.Any(cust => Condition1(cust));
condition2Result = customers.Any(cust => Condition2(cust));
Christian Hayter
Is it possible to do it in single LINQ query ?
jg
Possibly, but I personally agree with your comment above.
Christian Hayter