Joining multiple where clauses in LINQ as OR instead of AND

前端 未结 7 918
情书的邮戳
情书的邮戳 2020-12-16 13:33

Is there anyway to join LINQ where clauses as OR ?

var ints = new [] { 1, 3, 5, 7 };

var query = from i in ints select i;

query = query.Where (q => q ==         


        
7条回答
  •  时光取名叫无心
    2020-12-16 14:25

    Are you talking about specifying more than one condition in the lambda?

    query = query.Where(q => q == 3 ||
                             q == 7);
    

提交回复
热议问题