If you've ever wondered how to get the number of days for a given month in .NET, the solution is pretty easy:

System.DateTime.DaysInMonth(int year, int month)

Hope it helps!