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 DateTimeFormatInfo 由属性返回的对象的属性 CultureInfo.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.