foreach loop with a where clause

Yes, it is possible:

Method Syntax:

foreach (var person in people.Where(n => n.sex == "male"))
{
}

Or the rather lengthy Query Syntax:

foreach (var person in from person in people where person.sex == "male" select person) 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)