我仍然是Lambda的新手,我无法弄清楚如何编写类似于SQL的Lambda表达式。
SELECT *
FROM table1
WHERE ((date = todaysDate AND status = 'Paid')
OR
(paymentType = 'Visa' AND status = 'Pending'))
我可以使用Lambda而不是两者都使用一个子句。这就是我的......
payments = scheduledPayments.GetAll().Where(x => x.date == todaysDate
&& x.status == 'Paid');
提前致谢:)
答案 0 :(得分:2)
你试过这个:
payments = scheduledPayments.GetAll().Where(x =>
(x.date == todaysDate && x.status == "Paid") ||
(x.paymentType == "Visa" && x.status == "Pending")
);