我有以下型号linq select:
AVPlayer
此列表可包含约100条记录。
然后我有这个班:
List<EmployeeProfile> employee = DL.GetEmployeeProfile(id);
var result = employee.Select(a => new[]
{
a.EmployeeName,
a.EmployeeId.Tostring(),
a.View.ToString(),
a.Edit.ToString(),
a.Block.ToString()
}).ToList();
我从json填写了大约50条记录,所以我有:
public class EmployeeSelection
{
public Int64 employeeId{ get; set; }
public bool view { get; set; }
public bool edit { get; set; }
public bool block{ get; set; }
}
我需要更新List<EmployeeSelection> employeeSelect = JsonConvert.DeserializeObject<List<EmployeeSelection>>(selection);
列表覆盖result
匹配的employeeSelect
列表中的查看,修改或屏蔽值。
有任何线索吗?
答案 0 :(得分:0)
尝试使用linq查询:
var newResult= from empl in result
join sel in employeeSelect
on empl.EmployeeId equals sel.employeeId.ToString()
select new EmployeeProfile {
EmployeeId = empl.EmployeeId,
EmployeeName = empl.EmployeeName,
Edit = sel.edit.ToString(),
Block = sel.block.ToString(),
View = sel.view.ToString()
};
答案 1 :(得分:0)
您可以将两个列表连接在一起,只使用员工选择对象来填写新的详细信息
from Queue import Queue
...
ST_Q = Queue()
MD_Q = Queue()
def st():
ST_Q.put(ser1.readline())
def md():
MD_Q.put(ser2.readline())
threading.Timer(0, st).start()
threading.Timer(0, nd).start()
#while loop here?
fob.write(str(ST_Q.get())+' ' +str(MD_Q.get())+'\n')