Ejemplo n.º 1
0
    public static void Main()
    {
        // Creates and initializes a HijriCalendar.
        HijriCalendar myCal = new HijriCalendar();

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

        // Displays the value of the CurrentEra property.
        Console.Write("CurrentEra:");
        for (int y = 1421; y <= 1425; y++)
        {
            Console.Write("\t{0}", myCal.GetMonthsInYear(y, HijriCalendar.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 = 1421; y <= 1425; y++)
            {
                Console.Write("\t{0}", myCal.GetMonthsInYear(y, myCal.Eras[i]));
            }
            Console.WriteLine();
        }
    }
   public static void Main()  {

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

      // Checks all the months in five years in the current era.
      int iMonthsInYear;
      for ( int y = 1421; y <= 1425; y++ )  {
         Console.Write( "{0}:\t", y );
         iMonthsInYear = myCal.GetMonthsInYear( y, HijriCalendar.CurrentEra );
         for ( int m = 1; m <= iMonthsInYear; m++ )
            Console.Write( "\t{0}", myCal.IsLeapMonth( y, m, HijriCalendar.CurrentEra ) );
         Console.WriteLine();
      }
   }
Ejemplo n.º 3
0
 /// <summary>
 /// Gets the number of months in the specified year in the current era.
 /// </summary>
 /// <param name="year">An integer that represents the year.</param>
 /// <returns></returns>
 public int GetMonthsInYear(int year)
 {
     return(hc.GetMonthsInYear(year));
 }