示例:
EmpID GroupID Amount GroupCode
001 G01 1000 GC00001
001 G02 2000 GC00002
在我的列表中,我获得了EmployeeEmployee(E001,E001)。这里我如何将每个Emplid设置为groupCodeusing LINQ。
详情有(E001,E002)
Foreach(Employee empty in Details)
{
GroupDetails GD=a.GroupDetails(empty.EmppID) //as above data will have above example
Now GD has GC00001,GC00002
}
我们该怎么做?
答案 0 :(得分:0)
我认为你所寻找的是:
foreach (var employee in details)
{
var groupCodes = from item in a
where item.EmpID == employee.EmpID
select item.GroupCode;
// use groupCodes here...
}