Linq Where value is in Array

前端 未结 2 793
别那么骄傲
别那么骄傲 2021-01-01 12:59
IEnumerable periods = new string[] {\"ABC\", \"JKD\", \"223A\"};

var someData = from p in returns  
               from d in p.ReturnDet  
                    


        
相关标签:
2条回答
  • 2021-01-01 13:19
    var someData = from p in returns  
          from d in p.ReturnDet  
                    where p.Year > 2009 
                    where periods.Contains(d.Period)
    
    0 讨论(0)
  • 2021-01-01 13:21

    Use the Contains method.

    var someData = from p in returns   
                   from d in p.ReturnDet   
                   where p.Year > 2009  
                   where periods.Contains(d.Period);
    
    0 讨论(0)
提交回复
热议问题