我有一个如下查询。任何人都知道为什么?:部分总是返回错误值,尽管 LIST 中有项目包含。或者任何人有更好的想法来编写此查询,请随时在此处回复。谢谢。
List EList = new List();
EList.Add(new EmployeeInfo(1, "a1", "b1"));
EList.Add(new EmployeeInfo(2, "a2", "b2"));
List OList = new List();
OList.Add(new EmployeeInfo(1, "a1", "b1"));
OList.Add(new EmployeeInfo(2, "a2", "b2"));
OList.Add(new EmployeeInfo(3, "aa2", "bb2"));
var results = (
from e in b
select new
{
Id = e.ID,
Name = e.Name,
Email = e.Email,
IS_Elist = (EList.Contains(e))?true:false,
IS_Olist = (OList.Contains(e)) ? true : false,
}
).ToList();