【发布时间】:2015-07-13 21:53:44
【问题描述】:
这是我想要做的:
(Dc.DET_Cases.Where(c => c.ProductID == pl.ProductID
&& oldTOR == false ? c.OldTOR == oldTOR :
&& (productLineName.ToInt() == 0 || productLineName.ToInt() == c.ProductLineID)
&& (productCategory.ToInt() == 0 || productCategory.ToInt() == c.ProductCategoryID)
&& (issueType.ToInt() == 0 || issueType.ToInt() == c.IssueTypeID)
&& (issue.ToInt() == 0 || issue.ToInt() == c.IssueID)
)
.FirstOrDefault() != null)
这是我想要做的。
oldTOR == false ? c.OldTOR == oldTOR :
在where LINQ 语句中。如果该值为 false,则比较该值。如果没有,请忽略它。
【问题讨论】: