GregorianCalendar.CalendarType プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
現在の GregorianCalendarTypes の言語バージョンを示す GregorianCalendar 値を取得または設定します。
public:
virtual property System::Globalization::GregorianCalendarTypes CalendarType { System::Globalization::GregorianCalendarTypes get(); void set(System::Globalization::GregorianCalendarTypes value); };
public virtual System.Globalization.GregorianCalendarTypes CalendarType { get; set; }
member this.CalendarType : System.Globalization.GregorianCalendarTypes with get, set
Public Overridable Property CalendarType As GregorianCalendarTypes
プロパティ値
現在の GregorianCalendarTypes の言語バージョンを示す GregorianCalendar 値。
例外
set 操作で指定された値が GregorianCalendarTypes 列挙体のメンバーではありません。
set 操作において、現在のインスタンスが読み取り専用です。
例
次のコード例では、カルチャでサポートされているグレゴリオ暦Calendar 言語バージョンを確認する方法を示します。
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)
*/
using System;
using System.Globalization;
public class SamplesCultureInfo {
public static void Main() {
// 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.
Console.WriteLine( "The ar-SA culture supports the following calendars:" );
foreach ( Calendar cal in myOptCals ) {
if ( cal.GetType() == typeof( GregorianCalendar ) ) {
GregorianCalendar myGreCal = (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)
*/
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
End Class
'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)
適用対象
こちらもご覧ください
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET