I have a result set, say clientList. And I want to make sure that ALL the clients in the ClientList have a P开发者_运维问答rofession as "Banker". Let the result of the query be a boolean value.
How can I write the LINQ or lambda expression query to get the result?
if ( clientList.All(c=>c.Profession=="Banker") )
{
}
bool allAreBankers = ClientList.All(c=>c.Profession=="Banker");
精彩评论