//In this example i have 2 lists with the months numbers and i will check
//if the month have 31 or 30 days, using the method .IndexOf()
//this method search the array content and return a zero-based value,
//if found, otherwise return -1. In this example its using a List<int>
//the same process can be apllied for every list
List<int> m31 = new List<int>{ 1, 3, 5, 7, 8, 10, 12 };
List<int> m30 = new List<int>{ 4, 6, 9, 11 };
public string ValidaData(int month, int year)
{
if (m30.IndexOf(mes) != -1)
{
return "have 30 days";
}
else if(m31.IndexOf(mes) != -1)
{
return "have 30 days";
}
else if(mes == 2)
{
if(year % 4 == 0)
return "have 29 days";
else
return "have 28 days";
}
else
{
return "Unknown month";
}
}