This documentation is archived and is not being maintained.
GregorianCalendar::CalendarType Property
Visual Studio 2010
Gets or sets the GregorianCalendarTypes value that denotes the language version of the current GregorianCalendar.
Assembly: mscorlib (in mscorlib.dll)
public: virtual property GregorianCalendarTypes CalendarType { GregorianCalendarTypes get (); void set (GregorianCalendarTypes value); }
Property Value
Type: System.Globalization::GregorianCalendarTypesA 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.
using namespace System; using namespace System::Globalization; using namespace System::Collections; int main() { // Calendar* myOptCals[] = new CultureInfo(S"ar-SA") -> OptionalCalendars; CultureInfo^ MyCI = gcnew CultureInfo( "ar-SA" ); array<Calendar^>^myOptCals = MyCI->OptionalCalendars; // Checks which ones are GregorianCalendar then determines the GregorianCalendar version. Console::WriteLine( "The ar-SA culture supports the following calendars:" ); IEnumerator^ myEnum = myOptCals->GetEnumerator(); while ( myEnum->MoveNext() ) { Calendar^ cal = safe_cast<Calendar^>(myEnum->Current); if ( cal->GetType() == GregorianCalendar::typeid ) { GregorianCalendar^ myGreCal = dynamic_cast<GregorianCalendar^>(cal); GregorianCalendarTypes calType = myGreCal->CalendarType; Console::WriteLine( " {0} ( {1})", cal, calType ); } else Console::WriteLine( " {0}", cal ); } } /* 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) */
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: