Linq to SQL how to do “where [column] in (list of values)”

前端 未结 5 1708
情话喂你
情话喂你 2020-11-29 20:43

I have a function where I get a list of ids, and I need to return the a list matching a description that is associated with the id. E.g.:

public class CodeDa         


        
5条回答
  •  一个人的身影
    2020-11-29 21:24

     var filterTransNos = (from so in db.SalesOrderDetails
                        where  ItemDescription.Contains(ItemDescription)
                                select new { so.TransNo }).AsEnumerable();    
    
    
    listreceipt = listreceipt.Where(p => filterTransNos.Any(p2 => p2.TransNo == p.TransNo)).ToList();
    

提交回复
热议问题