Linq 包含

  • 887
  • 0

摘要:Linq 包含

在linq下如果要對某個欄位,下包含的條件
就類似 or 的感覺。

from p in 資料表
where (new int?[]{1,2}).Contains(p.欄位名)
               包含的條件-這邊用陣列
where !(new int?[]{1,2}).Contains(p.欄位名)
select p