score:75

Accepted answer

you can do the following...

List.Where(x => x.Name.ToString().Equals("Apple")).ToList()
    .ForEach( x => { if(x.Name == ""){}} );

score:2

Old thread but throwing an in my opinion cleaner syntax

foreach(var item in sequence.Where(s => s.Name.ToString() == "Apple"))
{
 // do whatever
}

score:3

Yes, It takes a lambda expressions, so you can put any valid c# expression in there

score:37

Yes, if-statement is commonly used inside the ForEach as below:

sequence.Where(x => x.Name.ToString().Equals("Apple"))
    .ToList()
    .ForEach( x =>
     {
       if(someCondition)
       {
         // Do some stuff here.
       }  
     });

Related Query