C# select case
You can use switch case, but c# does not support comma-separated case conditions.

public int getDaysInMonth(int strMonth,int strYear)

{

int strDays = 0;

Switch (strMonth)

{

Case 1:

Case 3:

Case 5:

Case 7:

Case 10:

Case 12:

strDays = 3 1; Break;

Case 4:

Case 6:

Case 9:

Case 1 1:

StrDays = 30 broken;

Case 2:

if((strYear % 4 = = 0 & amp; & ampstrYear % 100! = 0) || strYear % 400 == 0)

strDays = 29

other

strDays = 28

Break;

}

Return to strDays

}

}

PS: If your strMonth and strYear are strings, you can use int. StrMonth or transformation. ToInt32(strMonth) converts them to Int types.