如何使用LINQ创建IN
语句?
我有什么
var t = from i in emails
where i.Credencials_Id == agenciaid
select new
{
i.Alias,
i.Name,
i.Description,
i.Comentas,
i.DateHour,
i.Imovel_Id,
i.Email,
i.EmailCaptador
};
我想要的东西(像这样的东西)
var t = from i in emails
where i.Credencials_Id IN (agenciaid)
select new
{
i.Alias,
i.Name,
i.Description,
i.Comentas,
i.DateHour,
i.Imovel_Id,
i.Email,
i.EmailCaptador
};
int imovel = Convert.ToInt32(t.First().Imovel_Id);
答案 0 :(得分:1)
当您使用LINQ to Objects时,您可以使用它:
from i in emails
where agenciaid.Contains(i.Credencials_Id)
select new
{
i.Alias,
i.Name,
i.Description,
i.Comentas,
i.DateHour,
i.Imovel_Id,
i.Email,
i.EmailCaptador
};