下面是我基于以下条件检索一些数据的代码:
allMembers.Where(Function(x) Not x.firstDate Is Nothing Or
Not x.secondDate Is Nothing Or
Not x.thirdDate Is Nothing).ToList()
这将给我的数据,其中任何列有值(非null)
我的问题是,这段代码还将获取所有三列都有值的记录。我需要过滤这些记录,其中所有三列都有值,并获取三列中任何一列都有值的记录。
任何想法?
allMembers.Where(Function(x) Criteria(x)).ToList()
function Criteria (x as YourType) as boolean
dim test as int =IF(x.firstDate Is Nothing, 1, 0) +
IF(x.secondDate Is Nothing, 1, 0) +
IF(x.thirdDate Is Nothing, 1, 0)
return test > 0 and test < 3
end function