CalendarType Property
Collapse the table of content
Expand the table of content

GregorianCalendar.CalendarType Property

 

Gets or sets the GregorianCalendarTypes value that denotes the language version of the current GregorianCalendar.

Namespace:   System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

Public Overridable Property CalendarType As GregorianCalendarTypes

Property Value

Type: System.Globalization.GregorianCalendarTypes

A GregorianCalendarTypes value that denotes the language version of the current GregorianCalendar.

Exception Condition
ArgumentOutOfRangeException

The value specified in a set operation is not a member of the GregorianCalendarTypes enumeration.

InvalidOperationException

In a set operation, the current instance is read-only.

The following code example demonstrates how to determine the GregorianCalendar language version supported by the culture.

Imports System
Imports System.Globalization

Public Class SamplesCultureInfo

   Public Shared Sub Main()

      ' Gets the calendars supported by the ar-SA culture.
      Dim myOptCals As Calendar() = New CultureInfo("ar-SA").OptionalCalendars

      ' Checks which ones are GregorianCalendar then determines the GregorianCalendar version.
      Console.WriteLine("The ar-SA culture supports the following calendars:")
      Dim cal As Calendar
      For Each cal In  myOptCals
         If cal.GetType() Is GetType(GregorianCalendar)  Then
            Dim myGreCal As GregorianCalendar = CType(cal, GregorianCalendar)
            Dim calType As GregorianCalendarTypes = myGreCal.CalendarType
            Console.WriteLine("   {0} ({1})", cal, calType)
         Else
            Console.WriteLine("   {0}", cal)
         End If
      Next cal

   End Sub 'Main 

End Class 'SamplesCultureInfo


'This code produces the following output.
'
'The ar-SA culture supports the following calendars:
'   System.Globalization.HijriCalendar
'   System.Globalization.GregorianCalendar (USEnglish)
'   System.Globalization.GregorianCalendar (MiddleEastFrench)
'   System.Globalization.GregorianCalendar (Arabic)
'   System.Globalization.GregorianCalendar (Localized)
'   System.Globalization.GregorianCalendar (TransliteratedFrench)

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2016 Microsoft