CalendarAlgorithmType 枚举

定义

指定日历是阳历、阴历还是阴阳历。

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
继承
CalendarAlgorithmType
属性

字段

LunarCalendar 2

阴历。

LunisolarCalendar 3

阴阳历。

SolarCalendar 1

阳历。

Unknown 0

未知日历。

示例

下面的代码示例演示 了 AlgorithmType 属性和 CalendarAlgorithmType 枚举。

using namespace System;
using namespace System::Globalization;

namespace CalendarTypeExample
{
    static void Display(Calendar^ genericCalendar)
    {
        String^ calendarName = 
            genericCalendar->ToString()->PadRight(50, '.');
        Console::WriteLine("{0} {1}", calendarName, genericCalendar->GetType());
    }
}

int main() 
{
    GregorianCalendar^ gregorianCalendar = gcnew GregorianCalendar();
    HijriCalendar^ hijriCalendar = gcnew HijriCalendar();
    JapaneseLunisolarCalendar^ japaneseCalendar = 
        gcnew JapaneseLunisolarCalendar();
    CalendarTypeExample::Display(gregorianCalendar);
    CalendarTypeExample::Display(hijriCalendar);
    CalendarTypeExample::Display(japaneseCalendar);
    return 0;
}

/* This code example produces the following output.

System.Globalization.GregorianCalendar............ System.Globalization.GregorianCalendar
System.Globalization.HijriCalendar................ System.Globalization.HijriCalendar
System.Globalization.JapaneseLunisolarCalendar.... System.Globalization.JapaneseLunisolarCalendar

*/
// 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
'

注解

特定日历的日期计算取决于日历是基于太阳的、基于月球的还是基于 lunisolar 的。 例如,、 和 类基于太阳,HijriCalendarUmAlQuraCalendar 类基于月球,和 JapaneseLunisolarCalendarHebrewCalendar 类基于 lunisolar,因此使用太阳计算年和月和日的月球计算。JulianCalendarJapaneseCalendarGregorianCalendar

CalendarAlgorithmType由日历成员(如 属性)Calendar.AlgorithmType返回的值指定特定日历的基础。

适用于