Multiple Where clauses in Lambda expressions

前端 未结 5 1406
臣服心动
臣服心动 2020-12-23 13:42

I have a simple lambda expression that goes something like this:

x=> x.Lists.Include(l => l.Title).Where(l=>l.Title != String.Empty)
5条回答
  •  误落风尘
    2020-12-23 13:57

    Maybe

    x=> x.Lists.Include(l => l.Title)
        .Where(l => l.Title != string.Empty)
        .Where(l => l.InternalName != string.Empty)
    

    ?

    You can probably also put it in the same where clause:

    x=> x.Lists.Include(l => l.Title)
        .Where(l => l.Title != string.Empty && l.InternalName != string.Empty)
    

提交回复
热议问题