System.Globalization.CCEastAsianLunisolarCalendar.IsLeapYear C# (CSharp) Method

IsLeapYear() public static method

public static IsLeapYear ( int gyear ) : bool
gyear int
return bool
	public static bool IsLeapYear (int gyear)
	{

		// FIXME: it is still wrong.
		int d = gyear % 19;
		switch (d) {
		case 0: case 3: case 6: case 9: case 11: case 14: case 17:
			return true;
		default:
			return false;
		}
		/*
		int goldenNumber = (gyear - 1900) % 19;
		int epact = 29;
		bool leap = false;
		while (goldenNumber-- >= 0) {
			epact += 11;
			leap = epact > 30;
			if (epact > 30)
				epact -= 30;
		}
		return leap;
		*/
	}

Usage Example

        public override bool IsLeapYear(int year, int era)
        {
            int gregorianYear = M_CheckYEG(year, ref era);

            return(CCEastAsianLunisolarCalendar.IsLeapYear(gregorianYear));
        }