什么是linq或Lambda中的任何运算符 [英] what is the in, any operators in linq or Lambda
本文介绍了什么是linq或Lambda中的任何运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好
在in中,linq或Lambda中的任何运算符
我想选择所有作业ID,其中(1,2,3)中的job_id
或我如何发送条件
公共IQueryable< job_allowance> GetJob_Allowance()
{
返回this.ObjectContext.Job_Allowance.Where(ds => ds.Job_ID ---- {1,2,3});
}
感谢您的帮助
hi every om
whis the in , any operators in linq or Lambda
i want select all job id where job_id in (1,2,3)
or how i can send condition
public IQueryable<job_allowance> GetJob_Allowance()
{
return this.ObjectContext.Job_Allowance.Where(ds => ds.Job_ID ---- {1,2,3});
}
thanks for anyhelp
推荐答案
public IQueryable GetJob_Allowance()
{ var ListOfIdsA = new List<int>(){1,2,3};
return this.ObjectContext.Job_Allowance.Where(ds => ListOfIdsA.Contains(ds.Job_ID));
}
如果您从其他表格中获得了工作ID,请按如下所示创建工作ID列表并使用它.
If you get job ids from some other table create job id list as below and use that.
var ListOfIdsA = this.ObjectContext.Jobs.Select(j=>j.Job_id).ToList();
这篇关于什么是linq或Lambda中的任何运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文