CultureInfo.OptionalCalendars Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the list of calendars that can be used by this culture.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System.Globalization.Calendar ()An array that represents the calendars that can be used by the culture represented by this CultureInfo object.
To change the calendar used by this CultureInfo object, set the Calendar property of the DateTimeFormatInfo object that is returned by the DateTimeFormat property. The new calendar must be one of the calendars in the OptionalCalendars property array.
The following example demonstrates how to determine the GregorianCalendar versions that are supported by the culture.
Imports System.Globalization Public Class Example Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) ' 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. outputBlock.Text &= "The ar-SA culture supports the following calendars:" & vbCrLf 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 outputBlock.Text += String.Format(" {0} ({1})", cal, calType) & vbCrLf Else outputBlock.Text += String.Format(" {0}", cal) & vbCrLf 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)