开发者

LINQ Query to match a sequence

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜