[英]How to assign a same value to entity using LINQ
例子:
EmpID GroupID Amount GroupCode
001 G01 1000 GC00001
001 G02 2000 GC00002
在我的列表中,我得到了 EmployeeEmployee(E001,E001)。在這里,我如何使用 LINQ 將每個 Emplid 設置為 groupCode。
詳情有 (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
}
我們go怎么辦?
我認為你正在尋找的是這樣的:
foreach (var employee in details)
{
var groupCodes = from item in a
where item.EmpID == employee.EmpID
select item.GroupCode;
// use groupCodes here...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.