c# - Mixing two linq statement into one? -
i have 2 linq statements, both of them working. wondering if possible mix them 1 , proper list after 1 linq.
var result = list3.where(srodek => list4.any(x => x == srodek.srodek.category1) && (srodek.srodek.source.device == _text || srodek.srodek.id.device == _text)) .tolist(); var list666 = list3.select(obj => new { obj, dt = datetime.parseexact(obj.leftcolumn, dateformat, cultureinfo.invariantculture) }) .where(x => x.dt >= czas11 && x.dt <= czas22) .select(x => x.obj).tolist();
one list:
var result = list3.where(obj => { var dt = datetime.parseexact(obj.leftcolumn, dateformat, cultureinfo.invariantculture); return (list4.any(x => x == obj.srodek.category1) && (obj.srodek.source.device == _text || obj.srodek.id.device == _text)) || (dt >= czas11 && dt <= czas22);}) .tolist();
Comments
Post a Comment