Joining multiple where clauses in LINQ as OR instead of AND

前端 未结 7 909
情书的邮戳
情书的邮戳 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

    try this

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

    var query = ints.select(X=>X).where(X=>X==3||X==7);

    0 讨论(0)
提交回复
热议问题