Have a small problem with LINQ queries.
Basically I have two lists, filled with dates.
List<DateTime> start = GetListOfStartDates();
List<DateTime> end = GetListOfEndDates();
DateTime date = new DateTime(2012, 1, 1);
How do I perform a LINQ query, where I compare a date against the start and end date, basically in sense:
(start <= date && end >= date)
Obviously I understand that they are lists, so this does not work, how do I compare a single date against two lists of dates? Basically doing a between for a set of dates.
The start indices will always match end indices, start[7] will always match end[7]. I’m attempting to turn a mysql between-query into LINQ. So I’m looking for IF the given “date” is within any start-end pair.
Assuming I’m interpreting your question correctly (see my comment above) I think you are better off doing this as a for loop instead of a LINQ query. I’d do something like this: