我正在尝试使用GetValueOrDefault
而不是 null 并且不等于 1(下面的代码将对此进行解释)。
然而我得到了错误:
&& 不能应用于 bool 和 int
我在这里看不到错误:
string[] arrItems = new string[] {
"Laptop", "Workstation", "Mobile","Monitor", "Other Peripheral",
"Home Printer", "Home Router", "Removable Device" };
var tblequipments =
from d in db.tblEquipments.Include(t => t.User).Include(t => t.ChangeLog)
where (arrItems.Contains(d.AssetType)) &&
(d.Development.GetValueOrDefault(0)) &&
(d.Deleted == null || d.Deleted != 1 ) &&
(d.Stock == null || d.Stock != 1 ) &&
(d.DecommissionDate == Convert.ToDateTime("1900-01-01") ||
d.DecommissionDate == Convert.ToDateTime("0001-01-01") ||
d.DecommissionDate == null)
select d;