UmAlQuraCalendar.IsLeapYear(Int32, Int32) Method

Definition

Determines whether the specified year in the specified era is a leap year.

C#
public override bool IsLeapYear (int year, int era);

Parameters

year
Int32

A year.

era
Int32

An era. Specify UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra] or UmAlQuraEra.

Returns

true if the specified year is a leap year; otherwise, false.

Exceptions

year or era is outside the range supported by the UmAlQuraCalendar class.

Examples

The following example lists the number of days in ten consecutive years and calls the IsLeapYear method to determine which years are leap years.

C#
using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      Calendar cal = new UmAlQuraCalendar();
      int currentYear = cal.GetYear(DateTime.Now);

      for (int year = currentYear; year <= currentYear + 9; year++)
         Console.WriteLine("{0:d4}: {1} days {2}", year,
                           cal.GetDaysInYear(year, UmAlQuraCalendar.UmAlQuraEra),
                           cal.IsLeapYear(year, UmAlQuraCalendar.UmAlQuraEra) ?
                              "(Leap Year)" : "");
   }
}
// The example displays the following output:
//       1431: 354 days
//       1432: 354 days
//       1433: 355 days (Leap Year)
//       1434: 354 days
//       1435: 355 days (Leap Year)
//       1436: 354 days
//       1437: 354 days
//       1438: 354 days
//       1439: 355 days (Leap Year)
//       1440: 354 days

Remarks

A common year has 354 days and a leap year has 355 days.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0