【发布时间】:2019-04-24 07:10:08
【问题描述】:
我有一个名为specifications 的表和一个需要检查其值是否为空的列表字段。这是列表:
List<string> fieldList = new List<string>() { name1, name2, name3 }; //name of the fields
我已经尝试了以下方法:
var checkForNull = TableInfo.Get("specifications").Fields.Where(i => fieldList.Find(x=>x==null)))
但它不会选择null 值。
如何检查值,同时如何将此字段名称保存到新列表中?
示例: 我的列表中有 3 个名字(name1、name2、name3)和数据库中 是值(name1 = 30,name2 = null,name3 = null)
因此,name2 和 name3 将被添加到列表中。
所以我也试过了:
TableInfo.Get("specifications").Fields.Where(i => fieldList .Contains(i.Name) && i.IsEmptyValue(i));
但这不起作用。
【问题讨论】: