C# Lambda,除安置外
我想返回C# Lambda,除安置外,c#,lambda,C#,Lambda,我想返回局域网的列表,我想从列表中排除用户信息.Globals.LANID 代码: 错误: “IQueryable”不包含“除外”的定义 我想您要排除这一个ChildLAN,请使用Where: var LANlist = _context.CORP_MatrixPositionOLDWay .Where(x => x.ChildOrgLevel.StartsWith(ParentORG.ToString())) .Select(x => x
局域网的列表
,我想从列表中排除用户信息.Globals.LANID
代码:
错误:
“IQueryable”不包含“除外”的定义
我想您要排除这一个
ChildLAN
,请使用Where
:
var LANlist = _context.CORP_MatrixPositionOLDWay
.Where(x => x.ChildOrgLevel.StartsWith(ParentORG.ToString()))
.Select(x => x.ChildLAN)
.Where(lan => lan != UserInformation.Globals.LANID);
我想您要排除这一个
ChildLAN
,请使用Where
:
var LANlist = _context.CORP_MatrixPositionOLDWay
.Where(x => x.ChildOrgLevel.StartsWith(ParentORG.ToString()))
.Select(x => x.ChildLAN)
.Where(lan => lan != UserInformation.Globals.LANID);
您仍然可以使用Except实现它,只需传入IEnumerable:
var LANlist = _context.CORP_MatrixPositionOLDWay
.Where(x => x.ChildOrgLevel.StartsWith(ParentORG.ToString()))
.Select(x => x.ChildLAN)
.Except(new[] { UserInformation.Globals.LANID });
您仍然可以使用Except实现它,只需传入IEnumerable:
var LANlist = _context.CORP_MatrixPositionOLDWay
.Where(x => x.ChildOrgLevel.StartsWith(ParentORG.ToString()))
.Select(x => x.ChildLAN)
.Except(new[] { UserInformation.Globals.LANID });
获取两个可枚举项。
UserInformation.Globals.LANID是否为IEnumerable
?获取两个可枚举项。是UserInformation.Globals.LANID
一个IEnumerable
?非常感谢您,先生!我甚至没有想到要用“Where!=”这个词。总是试图用艰难的方式做事。非常感谢你,好先生!我甚至没有想到要用“Where!=”这个词。总是试图用艰难的方式做事。