DateTimeFormatInfo 建構函式

定義

初始化與文化特性無關 (不因文化特性而異) 之 DateTimeFormatInfo 類別的可寫入新執行個體。Initializes a new writable instance of the DateTimeFormatInfo class that is culture-independent (invariant).

public:
 DateTimeFormatInfo();
public DateTimeFormatInfo ();
Public Sub New ()

備註

此函式會DateTimeFormatInfo建立物件,表示不因文化特性而異的日期和時間資訊。This constructor creates a DateTimeFormatInfo object that represents the date and time information of the invariant culture. 若要建立DateTimeFormatInfo特定文化特性的物件,請CultureInfo建立該文化特性的物件,並DateTimeFormatInfo取出其CultureInfo.DateTimeFormat屬性所傳回的物件。To create a DateTimeFormatInfo object for a specific culture, create a CultureInfo object for that culture and retrieve the DateTimeFormatInfo object returned by its CultureInfo.DateTimeFormat property.

您可以修改這個DateTimeFormatInfo函式所建立之物件的屬性。The properties of the DateTimeFormatInfo object created by this constructor can be modified. 不過,您無法修改Calendar屬性,因為不因文化特性而異,只支援西曆的當地語系化版本。However, you cannot modify the Calendar property, because the invariant culture supports only a localized version of the Gregorian calendar. 若要建立DateTimeFormatInfo使用特定行事曆的物件,您必須具現CultureInfo化支援該行事曆的物件,並Calendar將行事曆指派DateTimeFormatInfoCultureInfo.DateTimeFormat屬性所傳回之物件的屬性。.To create a DateTimeFormatInfo object that uses a specific calendar, you must instantiate a CultureInfo object that supports that calendar and assign the calendar to the Calendar property of the DateTimeFormatInfo object returned by the CultureInfo.DateTimeFormat property.

適用於

另請參閱