KoreanCalendar.IsLeapYear(Int32, Int32) KoreanCalendar.IsLeapYear(Int32, Int32) KoreanCalendar.IsLeapYear(Int32, Int32) KoreanCalendar.IsLeapYear(Int32, Int32) Method

Definizione

Determina se l'anno specificato nell'era specificata è bisestile.Determines whether the specified year in the specified era is a leap year.

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

Parametri

year
Int32 Int32 Int32 Int32

Valore intero che rappresenta l'anno.An integer that represents the year.

era
Int32 Int32 Int32 Int32

Valore intero che rappresenta l'era.An integer that represents the era.

Restituisce

true se l'anno specificato è bisestile; in caso contrario, false.true if the specified year is a leap year; otherwise, false.

Eccezioni

year non è compreso nell'intervallo supportato dal calendario.year is outside the range supported by the calendar.

-oppure--or- era non è compreso nell'intervallo supportato dal calendario.era is outside the range supported by the calendar.

Esempi

Nell'esempio seguente vengono IsLeapYear chiamati cinque anni in ognuna delle ere.The following example calls IsLeapYear for five years in each of the eras.

using namespace System;
using namespace System::Globalization;
int main()
{
   
   // Creates and initializes a KoreanCalendar.
   KoreanCalendar^ myCal = gcnew KoreanCalendar;
   
   // Displays the header.
   Console::Write( "YEAR\t" );
   for ( int y = 4334; y <= 4338; y++ )
      Console::Write( "\t {0}", y );
   Console::WriteLine();
   
   // Checks five years in the current era.
   Console::Write( "CurrentEra:" );
   for ( int y = 4334; y <= 4338; y++ )
      Console::Write( "\t {0}", myCal->IsLeapYear( y, KoreanCalendar::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 = 4334; y <= 4338; y++ )
         Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) );
      Console::WriteLine();

   }
}

/*
This code produces the following output.

YEAR            4334    4335    4336    4337    4338
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/
using System;
using System.Globalization;


public class SamplesKoreanCalendar  {

   public static void Main()  {

      // Creates and initializes a KoreanCalendar.
      KoreanCalendar myCal = new KoreanCalendar();

      // Displays the header.
      Console.Write( "YEAR\t" );
      for ( int y = 4334; y <= 4338; y++ )
         Console.Write( "\t{0}", y );
      Console.WriteLine();

      // Checks five years in the current era.
      Console.Write( "CurrentEra:" );
      for ( int y = 4334; y <= 4338; y++ )
         Console.Write( "\t{0}", myCal.IsLeapYear( y, KoreanCalendar.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 = 4334; y <= 4338; y++ )
            Console.Write( "\t{0}", myCal.IsLeapYear( y, myCal.Eras[i] ) );
         Console.WriteLine();
      }

   }

}

/*
This code produces the following output.

YEAR            4334    4335    4336    4337    4338
CurrentEra:     False   False   False   True    False
Era 1:          False   False   False   True    False

*/
Imports System
Imports System.Globalization
Imports Microsoft.VisualBasic

Public Class SamplesKoreanCalendar   
   
   Public Shared Sub Main()

      ' Creates and initializes a KoreanCalendar.
      Dim myCal As New KoreanCalendar()

      ' Displays the header.
      Console.Write("YEAR" + ControlChars.Tab)
      Dim y As Integer
      For y = 4334 To 4338
         Console.Write(ControlChars.Tab + "{0}", y)
      Next y
      Console.WriteLine()

      ' Checks five years in the current era.
      Console.Write("CurrentEra:")
      For y = 4334 To 4338
         Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, KoreanCalendar.CurrentEra))
      Next y
      Console.WriteLine()

      ' Checks five years in each of the eras.
      Dim i As Integer
      For i = 0 To myCal.Eras.Length - 1
         Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i))
         For y = 4334 To 4338
            Console.Write(ControlChars.Tab + "{0}", myCal.IsLeapYear(y, myCal.Eras(i)))
         Next y
         Console.WriteLine()
      Next i

   End Sub 'Main 

End Class 'SamplesKoreanCalendar


'This code produces the following output.

'

'YEAR            4334    4335    4336    4337    4338

'CurrentEra:     False   False   False   True    False

'Era 1:          False   False   False   True    False


Commenti

Gli anni bisestili del calendario coreano corrispondono agli stessi anni bisestili del calendario gregoriano.Leap years in the Korean calendar correspond to the same leap years in the Gregorian calendar. Un anno bisestile nel calendario gregoriano viene definito come un anno gregoriano che è equamente divisibile per quattro, tranne nel caso in cui sia divisibile per 100.A leap year in the Gregorian calendar is defined as a Gregorian year that is evenly divisible by four, except if it is divisible by 100. Tuttavia, gli anni gregoriani divisibile per 400 sono anni bisestili.However, Gregorian years that are divisible by 400 are leap years. Un anno comune ha 365 giorni e un anno bisestile ha 366 giorni.A common year has 365 days and a leap year has 366 days.

Si applica a

Vedi anche