I have two DateTimes, and I want to get all DateTimes between these Dates. Such as, if my Dates are like 01.01.2010 - 05.01.2010, my function shoul
DateTime
How about something like this?
public IEnumerable DateRange(DateTime fromDate, DateTime toDate) { return Enumerable.Range(0, toDate.Subtract(fromDate).Days + 1) .Select(d => fromDate.AddDays(d)); }
Edit: Tested now. :)