UmAlQuraCalendar.IsLeapYear(Int32, Int32) 方法

定义

确定指定纪元中的指定年份是否为闰年。

public:
 override bool IsLeapYear(int year, int era);
public override bool IsLeapYear (int year, int era);
override this.IsLeapYear : int * int -> bool
Public Overrides Function IsLeapYear (year As Integer, era As Integer) As Boolean

参数

year
Int32

年份。

era
Int32

纪元。 指定 UmAlQuraCalendar.Eras[UmAlQuraCalendar.CurrentEra]UmAlQuraEra

返回

如果指定的年是闰年,则为 true;否则为 false

例外

yearera 超出了 UmAlQuraCalendar 类支持的范围。

示例

以下示例列出了连续十年的天数,并调用 IsLeapYear 方法来确定哪些年是闰年。

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
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim cal As New UmAlQuraCalendar()
      Dim currentYear As Integer = cal.GetYear(Date.Now)
      
      For year As Integer = currentYear To currentYear + 9
         Console.WriteLine("{0:d4}: {1} days {2}", year, 
                           cal.GetDaysInYear(year, UmAlQuraCalendar.UmAlQuraEra), 
                           If(cal.IsLeapYear(year, UmAlQuraCalendar.UmAlQuraEra),
                              "(Leap Year)", ""))        
      Next   
   End Sub
End Module
' 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

注解

普通年份有 354 天,闰年有 355 天。

适用于