C# query List<Tuple> using LINQ -
i have list , need start reading when item1 great myvariable. can using loop , if statement can me using linq?
var listdate = new list<tuple<datetime, double>>(); foreach (var item in listdate) { if (item.item1 > myvariable) console.writeline(item); }
the linq counterpart of if
where
:
ienumerable<tuple<datetime, double>> query = listdate.where(t => t.item1 > myvariable);
you can use foreach
-loop or method tolist
consume query.
Comments
Post a Comment