ASP.Net
I recently found myself in the situation where I had to loop through all the days from a StartDate to an EndDate. Sure easy, all you need to do is something like this: DateTime startDate = DateTime.Now;
DateTime endDate = DateTime.Now.AddDays(3);
DateTime curDate = startDate;
while (curDate <= endDate)
{
//Do Something with curDate ...
curDate = curDate.AddDays(1);
}
Does the job, but it is not very intuitive in my opinion. It is not that easy to read.
Wouldn't it be so much nicer if we could do something like this:
DayIterator dayIterator =...
Dont Repeat Yourself, we see it all over, but yet the suggested way of doing things with a Repeater control makes many developers repeat code. Let me explain what I mean, say we want to use a repeater to render a table containing rows of alternating colors. Sure there is a GridView for this, but there are some cases when we would like to use the more lightweight repeater (especially if we just want a readonly representation and do not want editing capabilities) As you already know, alternating rows in the...