LINQ: Select <contition> OR <condition>
Pseudo code:
SELECT * FROM 'table' WHERE ('date' < today)开发者_StackOverflow OR ('visible' = false)
How do you do OR in Linq?
You just use the language specific OR condition. In C#:
var results = from row in table
where row.date < today || row.visible == false
select row;
If you prefer the method syntax:
var results = table.Where(row => row.date < today || row.visible == false);
Reed nailed the C# one, here is the VB.Net equivalent
Dim results = _
From row In table _
Where row.Date < today OrElse row.Visible = False
精彩评论