Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CultureInfo.OptionalCalendars Property

Gets the list of calendars that can be used by this culture.

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

public virtual Calendar[] OptionalCalendars { get; }

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.


using System;
using System.Globalization;


public class Example
{

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {

      // Gets the calendars supported by the ar-SA culture.
      Calendar[] myOptCals = 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:" + "\n";
      foreach (Calendar cal in myOptCals)
      {
         if (cal.GetType() == typeof(GregorianCalendar))
         {
            GregorianCalendar myGreCal = (GregorianCalendar)cal;
            GregorianCalendarTypes calType = myGreCal.CalendarType;
            outputBlock.Text += String.Format("   {0} ({1})", cal, calType) + "\n";
         }
         else
         {
            outputBlock.Text += String.Format("   {0}", cal) + "\n";
         }
      }

   }

}

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

*/


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2014 Microsoft