我在员工和团队之间有很多很多关系.遵循linq声明
int[] GroupIDs = {6,7};
var result = from g in umGroups
join empGroup in umEmployeeGroups on g.GroupID equals empGroup.GroupID
where GroupIDs.Contains(g.GroupID)
select new { GrpId = g.GroupID,EmployeeID = empGroup.EmployeeID };
Run Code Online (Sandbox Code Playgroud)
返回groupid和employeeid.结果是
GrpId | EmployeeID
6 | 18
6 | 20
7 | 19
7 | 20
Run Code Online (Sandbox Code Playgroud)
我需要删除employeeid重复的行,例如employeeid = 20中的任何一行
谢谢
我有一个具有属性的对象列表,可用于将对象分成对.我事先知道每个物体都是一对的一部分.
这是一个说明情况的例子:
假设我的清单如下:
List<Shoe> shoes = new List<Shoe>();
shoes.Add(new Shoe { Id = 19, Brand = "Nike", LeftOrRight = LeftOrRight.L });
shoes.Add(new Shoe { Id = 29, Brand = "Nike", LeftOrRight = LeftOrRight.R });
shoes.Add(new Shoe { Id = 11, Brand = "Nike", LeftOrRight = LeftOrRight.L });
shoes.Add(new Shoe { Id = 60, Brand = "Nike", LeftOrRight = LeftOrRight.R });
shoes.Add(new Shoe { Id = 65, Brand = "Asics", LeftOrRight = LeftOrRight.L });
shoes.Add(new Shoe { Id = 82, …Run Code Online (Sandbox Code Playgroud)