我需要使用 or 运算符构建动态 linq 查询。我见过 PredicateBuilder 但那是在 C# 中,我的项目是在 VB 中。基本上我需要建立一个类似于这样的 WHERE 子句:
Where((this = 1 AND that = 2) OR (this = 1 AND that = 4) OR (this = 2 AND that = 4))
但问题是数字必须在运行时动态确定,并使用循环添加,比如
for each item in myItems
query = query.OR (this = item.a AND this = item.b)
next
我怎么能这样做呢?