CultureInfo.Calendar 屬性

定義

取得文化特性使用的預設曆法。

public:
 virtual property System::Globalization::Calendar ^ Calendar { System::Globalization::Calendar ^ get(); };
public virtual System.Globalization.Calendar Calendar { get; }
member this.Calendar : System.Globalization.Calendar
Public Overridable ReadOnly Property Calendar As Calendar

屬性值

Calendar

Calendar,代表文化特性所使用的預設曆法。

備註

使用者可以選擇透過主控台的 [地區及語言選項] 部分,覆寫與目前 Windows 文化特性相關聯的一些值。 例如,使用者可能會選擇以不同的格式顯示日期,或使用文化特性以外的其他貨幣。

如果 UseUserOverridetrue ,且指定的文化特性符合 Windows 目前的文化特性,則會 CultureInfo 使用這些覆寫,包括屬性所傳回之實例屬性的使用者設定 DateTimeFormatInfo DateTimeFormat ,以及 NumberFormatInfo 屬性所傳回之實例的屬性 NumberFormat 。 如果使用者設定與與相關聯的文化特性不相容 CultureInfo ,例如,如果選取的行事曆不是的其中一個 OptionalCalendars ,則方法的結果和屬性的值都是未定義的。

因此,如果 UseUserOverridetrue ,這個屬性的值可能會與文化特性所使用的預設行事曆不同。

您的應用程式 CultureInfo 會藉由設定的 Calendar 屬性 DateTimeFormat (也就是類別的實例)來變更目前使用的行事曆 DateTimeFormatInfo 。 新行事曆必須是中所列的其中一個行事曆 OptionalCalendarsDateTimeFormat 也包含自訂與該相關聯之日期和時間格式的其他屬性 Calendar

適用於

另請參閱