I have this linq query request as:
var test = (...
where ...
&& test.SL.Any(line =>
line.ServiceCode == serviceCode
&& line.DateOfServiceStart >= dateOfServiceStart
&& (line.DateOfServiceEnd == null || line.DateOfServiceEnd <= dateOfServiceEnd)
)
select test).Distinct();
The type of line.DateOfServiceEnd is DateOnly, the value of the current result of this date is: 4/1/2024
, and the dateOfServiceEnd parameter is: 12/1/2024
, but it's returning results! Its supposed not to return results because 12/1/2024
is > than 4/1/2024
, why is it returning results?
line.DateOfServiceEnd <= dateOfServiceEnd
so replacing with values gets4/1/2024 <= 12/1/2024
which istrue
what exactly is the question? Did you perhaps want>
not<=
?