CalendarAlgorithmType Enum

Definition

Anger om en kalender är solbaserad, månbaserad eller lunisolarbaserad.

public enum class CalendarAlgorithmType
public enum CalendarAlgorithmType
[System.Runtime.InteropServices.ComVisible(true)]
public enum CalendarAlgorithmType
type CalendarAlgorithmType = 
[<System.Runtime.InteropServices.ComVisible(true)>]
type CalendarAlgorithmType = 
Public Enum CalendarAlgorithmType
Arv
CalendarAlgorithmType
Attribut

Fält

Name Värde Description
Unknown 0

En okänd kalenderbas.

SolarCalendar 1

En solbaserad kalender.

LunarCalendar 2

En månbaserad kalender.

LunisolarCalendar 3

En lunisolarbaserad kalender.

Exempel

I följande kodexempel visas AlgorithmType egenskapen och CalendarAlgorithmType uppräkningen.

// This example demonstrates the Calendar.AlgorithmType property and
// CalendarAlgorithmType enumeration.

using System;
using System.Globalization;

class Sample
{
    public static void Main()
    {
    GregorianCalendar grCal = new GregorianCalendar();
    HijriCalendar     hiCal = new HijriCalendar();
    JapaneseLunisolarCalendar
                      jaCal = new JapaneseLunisolarCalendar();
    Display(grCal);
    Display(hiCal);
    Display(jaCal);
    }

    static void Display(Calendar c)
    {
    string name = c.ToString().PadRight(50, '.');
    Console.WriteLine("{0} {1}", name, c.AlgorithmType);
    }
}
/*
This code example produces the following results:

System.Globalization.GregorianCalendar............ SolarCalendar
System.Globalization.HijriCalendar................ LunarCalendar
System.Globalization.JapaneseLunisolarCalendar.... LunisolarCalendar

*/
' This example demonstrates the Calendar.AlgorithmType property and
' CalendarAlgorithmType enumeration.
Imports System.Globalization

Class Sample
   Public Shared Sub Main()
      Dim grCal As New GregorianCalendar()
      Dim hiCal As New HijriCalendar()
      Dim jaCal As New JapaneseLunisolarCalendar()
      Display(grCal)
      Display(hiCal)
      Display(jaCal)
   End Sub
   
   Shared Sub Display(c As Calendar)
      Dim name As String = c.ToString().PadRight(50, "."c)
      Console.WriteLine("{0} {1}", name, c.AlgorithmType)
   End Sub
End Class
'
'This code example produces the following results:
'
'System.Globalization.GregorianCalendar............ SolarCalendar
'System.Globalization.HijriCalendar................ LunarCalendar
'System.Globalization.JapaneseLunisolarCalendar.... LunisolarCalendar
'

Kommentarer

En datumberäkning för en viss kalender beror på om kalendern är solbaserad, månbaserad eller lunisolarbaserad. Klasserna GregorianCalendar, JapaneseCalendar, och JulianCalendar är till exempel solbaserade, HijriCalendar klasserna och UmAlQuraCalendar är månbaserade.och HebrewCalendar klasserna och JapaneseLunisolarCalendar är lunisolarbaserade, och använder därför solberäkningar för året och månberäkningar för månad och dag.

Ett CalendarAlgorithmType värde som returneras av en kalendermedlem, till exempel Calendar.AlgorithmType egenskapen, anger grunden för en viss kalender.

Gäller för