My Birthday

Today is my birthday and because today my thoughts are only about myself, I had a curiosity about in which years I did celebrate my birthday on Wednesdays ( I like this day of week).
With the following LINQ query I found the answer

from i in Enumerable.Range(0,29)
where (new DateTime(i + 1983,4,6).DayOfWeek) == DayOfWeek.Wednesday
select new { year = i + 1983, age = i }

which is..

Year Age
1983 0
1988 5
1994 11
2005 22
2011 28

And because my curiosity about me and only me goes mad, I wanted to find out more about each day of week and my birthdays.

Enumerable.Range(0,29).ToLookup(i =>new DateTime(i + 1983,4,6).DayOfWeek, i=>new {year = i + 1983,age = i}).OrderBy(d=>(int)d.Key)

click on the image to see it in full size

Thanks to LINQ Pad.

Comments

Post a Comment

Popular posts from this blog

IIS 7.5, HTTPS Bindings and ERR_CONNECTION_RESET

Verify ILogger calls with Moq.ILogger

Table Per Hierarchy Inheritance with Column Discriminator and Associations used in Derived Entity Types