IEnumerable<string> periods = new string[] {"ABC", "JKD", "223A"};
var someData = from p in returns
from d in p.ReturnDet
where p.Year > 2009
where d.Period <is in periods array>
如何选择句点数组中包含d.periods的值?
答案 0 :(得分:35)
使用Contains方法。
var someData = from p in returns
from d in p.ReturnDet
where p.Year > 2009
where periods.Contains(d.Period);
答案 1 :(得分:3)
var someData = from p in returns
from d in p.ReturnDet
where p.Year > 2009
where periods.Contains(d.Period)