countrymeister
asked on
Linq to select select top 1
I need to get a row from my gneic list where the BusDate is less than a variable date.
The qualifying date should be the max date returned, instead I get the lowest date that qualifies to be less than s.BusDte
I tried first or default
SomeObject s
var result = (from q in list
where q.ID.ToString() == s.ID && q.BusDate <= s.BusDate
select q.Total).Take(1).LastOrDef ault();
The qualifying date should be the max date returned, instead I get the lowest date that qualifies to be less than s.BusDte
I tried first or default
SomeObject s
var result = (from q in list
where q.ID.ToString() == s.ID && q.BusDate <= s.BusDate
select q.Total).Take(1).LastOrDef
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.