以下是我根据以下标准检索某些数据的代码:
allMembers.Where(Function(x) Not x.firstDate Is Nothing Or
Not x.secondDate Is Nothing Or
Not x.thirdDate Is Nothing).ToList()
这将为我提供任何列具有值(非空)
的数据我的问题是,此代码还将获取所有三列都具有值的记录。我需要过滤那些记录,其中所有三列都有值,并获得三列中任何一列都有值的记录。
任何想法?
答案 0 :(得分:0)
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