【发布时间】:2017-11-08 18:18:19
【问题描述】:
我正在生成两个具有 int 值的列表,并使用 linq 选择列表 2 中未找到的列表 1 的所有 id:
var clerkRole = db.Roles.SingleOrDefault(m => m.Name == "Clerk");
List<ApplicationUser>lstUser = db.Users.Where(x => x.Roles.Select(y => y.RoleId).Contains(clerkRole.Id)).ToList();
List<int> lstUId = lstUser.Select(c => c.Id).ToList();
var alldps = db.Deposits.Select(a => a.UserId).Distinct().ToList();
var clerkNotIn = lstUId.Except(alldps).ToList(); // error here and below
我收到以下错误:
错误 25 'System.Collections.Generic.List' 不包含 'Except' 的定义和最佳扩展方法重载 'System.Linq.ParallelEnumerable.Except(System.Linq.ParallelQuery, System.Collections.Generic. IEnumerable)' 有一些无效参数
你能帮忙吗?谢谢
【问题讨论】:
标签: c# asp.net-mvc linq