HebrewCalendar.GetMonthsInYear(Int32, Int32) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Devolve o número de meses do ano especificado na era especificada.
public:
override int GetMonthsInYear(int year, int era);
public override int GetMonthsInYear(int year, int era);
override this.GetMonthsInYear : int * int -> int
abstract member GetMonthsInYear : int * int -> int
override this.GetMonthsInYear : int * int -> int
Public Overrides Function GetMonthsInYear (year As Integer, era As Integer) As Integer
Parâmetros
- year
- Int32
Um número inteiro que representa o ano.
- era
- Int32
Um inteiro que representa a era. Especifique ou HebrewEra ou HebrewCalendar.Eras[Calendar.CurrentEra].
Devoluções
O número de meses no ano especificado na era especificada. O valor de retorno é 12 num ano comum, ou 13 num ano bissexto.
Exceções
year ou era está fora do alcance suportado pelo objeto atual HebrewCalendar .
Exemplos
O seguinte exemplo de código exige GetMonthsInYear cinco anos em cada era.
using System;
using System.Globalization;
public class SamplesHebrewCalendar {
public static void Main() {
// Creates and initializes a HebrewCalendar.
HebrewCalendar myCal = new HebrewCalendar();
// Displays the header.
Console.Write( "YEAR\t" );
for ( int y = 5761; y <= 5765; y++ )
Console.Write( "\t{0}", y );
Console.WriteLine();
// Displays the value of the CurrentEra property.
Console.Write( "CurrentEra:" );
for ( int y = 5761; y <= 5765; y++ )
Console.Write( "\t{0}", myCal.GetMonthsInYear( y, HebrewCalendar.CurrentEra ) );
Console.WriteLine();
// Displays the values in the Eras property.
for ( int i = 0; i < myCal.Eras.Length; i++ ) {
Console.Write( "Era {0}:\t", myCal.Eras[i] );
for ( int y = 5761; y <= 5765; y++ )
Console.Write( "\t{0}", myCal.GetMonthsInYear( y, myCal.Eras[i] ) );
Console.WriteLine();
}
}
}
/*
This code produces the following output.
YEAR 5761 5762 5763 5764 5765
CurrentEra: 12 12 13 12 13
Era 1: 12 12 13 12 13
*/
Imports System.Globalization
Public Class SamplesHebrewCalendar
Public Shared Sub Main()
' Creates and initializes a HebrewCalendar.
Dim myCal As New HebrewCalendar()
' Displays the header.
Console.Write("YEAR" + ControlChars.Tab)
Dim y As Integer
For y = 5761 To 5765
Console.Write(ControlChars.Tab + "{0}", y)
Next y
Console.WriteLine()
' Displays the value of the CurrentEra property.
Console.Write("CurrentEra:")
For y = 5761 To 5765
Console.Write(ControlChars.Tab + "{0}", myCal.GetMonthsInYear(y, HebrewCalendar.CurrentEra))
Next y
Console.WriteLine()
' Displays the values in the Eras property.
Dim i As Integer
For i = 0 To myCal.Eras.Length - 1
Console.Write("Era {0}:" + ControlChars.Tab, myCal.Eras(i))
For y = 5761 To 5765
Console.Write(ControlChars.Tab + "{0}", myCal.GetMonthsInYear(y, myCal.Eras(i)))
Next y
Console.WriteLine()
Next i
End Sub
End Class
'This code produces the following output.
'
'YEAR 5761 5762 5763 5764 5765
'CurrentEra: 12 12 13 12 13
'Era 1: 12 12 13 12 13
Observações
Esta implementação da HebrewCalendar classe reconhece apenas os anos hebraicos de 5343 a 5999 (1583 a 2239 no calendário gregoriano).