Like the title says:
I have a DateTime start
and a DateTime stop
Now i want to compare these with a List<DateTime> dates
I just wanto check if the list dates
is between start
and stop
if(dates.all(..... >= start && <= stop)) {
. do something
}
The pseudo-code in your question is not far from the working code you're looking for.
Using LINQ's All() method:
if (dates.All(date => date >= start && date <= stop)) {
// Do something.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With