我想使用'!'在我的.Where中排除以下记录。
语法是什么?
// where do I put the ! to get the syntax correct
.Where(p => p.StartDate >= startDate && p.EndDate <= DateTime.Now.Date)
答案 0 :(得分:1)
.Where(p => !(p.StartDate >= startDate && p.EndDate <= DateTime.Now.Date))
OR
.Where(p => p.StartDate < startDate || p.EndDate > DateTime.Now.Date)