public static void Main() { // Creates and initializes a HijriCalendar. HijriCalendar myCal = new HijriCalendar(); // Displays the header. Console.Write("YEAR\t"); for (int y = 1421; y <= 1425; y++) { Console.Write("\t{0}", y); } Console.WriteLine(); // Checks five years in the current era. Console.Write("CurrentEra:"); for (int y = 1421; y <= 1425; y++) { Console.Write("\t{0}", myCal.IsLeapYear(y, HijriCalendar.CurrentEra)); } Console.WriteLine(); // Checks five years in each of the eras. for (int i = 0; i < myCal.Eras.Length; i++) { Console.Write("Era {0}:\t", myCal.Eras[i]); for (int y = 1421; y <= 1425; y++) { Console.Write("\t{0}", myCal.IsLeapYear(y, myCal.Eras[i])); } Console.WriteLine(); } }
public static int GetHijriMonthMaxDayNumber(this HijriMonth month, int year) { switch (month) { case HijriMonth.Muharram: case HijriMonth.RabialAwal: case HijriMonth.JamadiAwal: case HijriMonth.Rajab: case HijriMonth.Ramadan: case HijriMonth.DualQadah: return(30); case HijriMonth.Safar: case HijriMonth.RabialThani: case HijriMonth.JamadiThani: case HijriMonth.Shaban: case HijriMonth.Shawal: return(29); case HijriMonth.DualHijjah: return(_hijriCalendar.IsLeapYear(year) ? 30 : 29); default: throw new NotSupportedException("Invalid Month!"); } }