Days in a month in C#

You can get the total days in a month easily by giving year and month as inputs.
Year is mandatory here because C# has to validate like leap year functionality internally.
(i.e) 2011 - 02 --> 28 days
2012 -02 --> 29 days.

Syntax:
DaysInMonth(int year, int month)


Example:

using System;

namespace forgetCode
{
    class Program
    {
        static void Main(string[] args)
        {
        
     Console.WriteLine("Enter year");
     int year = Convert.ToInt32(Console.ReadLine());


     Console.WriteLine("Enter month");
     int month = Convert.ToInt32(Console.ReadLine());

            
     Console.WriteLine("Days in the month:"+DateTime.DaysInMonth(year,month));                    
        }

    }
}


Output:

Enter year
2012
Enter month
02
Days in the month :29


Enter year
2015
Enter month
02
Days in the month :28


..