当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET GregorianCalendar.AlgorithmType属性代码示例

本文整理汇总了VB.NET中System.Globalization.GregorianCalendar.AlgorithmType属性的典型用法代码示例。如果您正苦于以下问题:VB.NET GregorianCalendar.AlgorithmType属性的具体用法?VB.NET GregorianCalendar.AlgorithmType怎么用?VB.NET GregorianCalendar.AlgorithmType使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Globalization.GregorianCalendar的用法示例。


在下文中一共展示了GregorianCalendar.AlgorithmType属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: Example

' 导入命名空间
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
开发者ID:VB.NET开发者,项目名称:System.Globalization,代码行数:49,代码来源:GregorianCalendar.AlgorithmType

输出:

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


注:本文中的System.Globalization.GregorianCalendar.AlgorithmType属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。