Tuesday, September 15, 2009

Age Extension Methods for .Net DateTime Type

There is not really a straightforward method to calculate a person’s age using the .Net DateTime type. Subtracting years is not a correct means. What is required is to round down a person’s age until that person’s birthday has passed for the given year it is being calculated against. This is what these simple set of extensions to the .Net DateTime class intend to provide.

0 comments: