Calendar.AlgorithmType Calendar.AlgorithmType Calendar.AlgorithmType Calendar.AlgorithmType Property

정의

현재 달력이 양력인지, 음력인지 또는 두 가지를 조합한 것인지를 나타내는 값을 가져옵니다.Gets a value indicating whether the current calendar is solar-based, lunar-based, or a combination of both.

public:
 virtual property System::Globalization::CalendarAlgorithmType AlgorithmType { System::Globalization::CalendarAlgorithmType get(); };
[System.Runtime.InteropServices.ComVisible(false)]
public virtual System.Globalization.CalendarAlgorithmType AlgorithmType { get; }
member this.AlgorithmType : System.Globalization.CalendarAlgorithmType
Public Overridable ReadOnly Property AlgorithmType As CalendarAlgorithmType

속성 값

예제

다음 예제에서는 리플렉션을 사용 하 여 .net Calendar 에서 발견 된 각 형식을 인스턴스화하고 해당 AlgorithmType 속성의 값을 표시 합니다.The following example uses reflection to instantiate each Calendar type found in .NET and displays the value of its AlgorithmType property.

using System;
using System.Collections;
using System.Globalization;
using System.Reflection;

public class Example
{
   public static void Main()
   {
      Assembly assem = Assembly.GetAssembly(typeof(Calendar));
      Type[] types = assem.GetExportedTypes();
      Type[] calendars = Array.FindAll(types, IsValidCalendar);
      Array.Sort(calendars, new CalendarComparer());

      Console.WriteLine("{0,-30} {1}\n", "Calendar", "Algorithm Type");
      foreach (var cal in calendars) {
         // Instantiate a calendar object.
         ConstructorInfo ctor = cal.GetConstructor( new Type[] {} );
         Calendar calObj = (Calendar) ctor.Invoke( new Type[] {} ); 

         Console.WriteLine("{0,-30} {1}", 
                          cal.ToString().Replace("System.Globalization.", ""),
                          cal.InvokeMember("AlgorithmType", 
                                           BindingFlags.Public | BindingFlags.Instance | BindingFlags.GetProperty,
                                           null, calObj, null));
      }
   }

   private static bool IsValidCalendar(Type t)
   {
        if (t.IsSubclassOf(typeof(Calendar)))
            if (t.IsAbstract)
                return false;
            else
                return true;
        else
            return false;
   }
}

public class CalendarComparer : IComparer
{
   public int Compare(object x, object y)
   {
      Type tX = (Type) x;
      Type tY = (Type) y;

      return tX.Name.CompareTo(tY.Name);
   }
}
// The example displays the following output:
//       Calendar                       Algorithm Type
//       
//       ChineseLunisolarCalendar       LunisolarCalendar
//       GregorianCalendar              SolarCalendar
//       HebrewCalendar                 LunisolarCalendar
//       HijriCalendar                  LunarCalendar
//       JapaneseCalendar               SolarCalendar
//       JapaneseLunisolarCalendar      LunisolarCalendar
//       JulianCalendar                 SolarCalendar
//       KoreanCalendar                 SolarCalendar
//       KoreanLunisolarCalendar        LunisolarCalendar
//       PersianCalendar                SolarCalendar
//       TaiwanCalendar                 SolarCalendar
//       TaiwanLunisolarCalendar        LunisolarCalendar
//       ThaiBuddhistCalendar           SolarCalendar
//       UmAlQuraCalendar               LunarCalendar
Imports System.Collections
Imports System.Globalization
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim assem As Assembly = Assembly.GetAssembly(GetType(Calendar))
      Dim types() As Type = assem.GetExportedTypes()
      Dim calendars() As Type = Array.FindAll(types, AddressOf IsValidCalendar)
      Array.Sort(calendars, New CalendarComparer())

      Console.WriteLine("{0,-30} {1}", "Calendar", "Algorithm Type")
      Console.WriteLine()
      For Each cal In calendars
         ' Instantiate a calendar object.
         Dim ctor As ConstructorInfo = cal.GetConstructor( {} )
         Dim calObj As Calendar = CType(ctor.Invoke( {} ), Calendar) 

         Console.WriteLine("{0,-30} {1}", 
                          cal.ToString().Replace("System.Globalization.", ""),
                          cal.InvokeMember("AlgorithmType", 
                                           BindingFlags.Public Or BindingFlags.Instance Or BindingFlags.GetProperty,
                                           Nothing, calObj, Nothing))
      Next
   End Sub
   
   Private Function IsValidCalendar(ByVal t As Type) As Boolean
        If t.IsSubClassOf(GetType(Calendar)) Then
            If t.IsAbstract Then
                Return False
            Else
                Return True
            End If
        Else
            Return False
        End If
    End Function
End Module

Public Class CalendarComparer : Implements IComparer
   Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer _
                  Implements IComparer.Compare
      Dim tX As Type = DirectCast(x, Type)
      Dim tY As Type = DirectCast(y, Type)

      Return tX.Name.CompareTo(tY.Name)
   End Function
End Class
' The example displays the following output:
'       Calendar                       Algorithm Type
'       
'       ChineseLunisolarCalendar       LunisolarCalendar
'       GregorianCalendar              SolarCalendar
'       HebrewCalendar                 LunisolarCalendar
'       HijriCalendar                  LunarCalendar
'       JapaneseCalendar               SolarCalendar
'       JapaneseLunisolarCalendar      LunisolarCalendar
'       JulianCalendar                 SolarCalendar
'       KoreanCalendar                 SolarCalendar
'       KoreanLunisolarCalendar        LunisolarCalendar
'       PersianCalendar                SolarCalendar
'       TaiwanCalendar                 SolarCalendar
'       TaiwanLunisolarCalendar        LunisolarCalendar
'       ThaiBuddhistCalendar           SolarCalendar
'       UmAlQuraCalendar               LunarCalendar

적용 대상