DateTimeFormatInfo.DayNames 屬性

定義

取得或設定包含特定文化特性之一週日期完整名稱的一維字串陣列。Gets or sets a one-dimensional string array that contains the culture-specific full names of the days of the week.

public:
 property cli::array <System::String ^> ^ DayNames { cli::array <System::String ^> ^ get(); void set(cli::array <System::String ^> ^ value); };
public string[] DayNames { get; set; }
member this.DayNames : string[] with get, set
Public Property DayNames As String()

屬性值

String[]

包含特定文化特性之一週日期完整名稱的一維字串陣列。A one-dimensional string array that contains the culture-specific full names of the days of the week. InvariantInfo 的陣列包含 "Sunday"、"Monday"、"Tuesday"、"Wednesday"、"Thursday"、"Friday" 和 "Saturday"。The array for InvariantInfo contains "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", and "Saturday".

例外狀況

此屬性已設定為 nullThe property is being set to null.

正在將屬性設定為多維或長度不是剛好為 7 的陣列。The property is being set to an array that is multidimensional or that has a length that is not exactly 7.

屬性已設定,而且 DateTimeFormatInfo 物件是唯讀的。The property is being set and the DateTimeFormatInfo object is read-only.

備註

如果設定這個屬性,陣列必須是一維,而且必須正好有七個元素。If setting this property, the array must be one-dimensional and must have exactly seven elements. 第一個專案(位於索引零的元素)代表日曆中一周的第一天,由 Calendar 屬性所定義。The first element (the element at index zero) represents the first day of the week in the calendar defined by the Calendar property.

如果自訂格式字串包含 "dddd" 格式規範,則 DateTime.ToString 方法會在結果字串中包含適當 DayNames 成員的值,以取代 "dddd"。If a custom format string includes the "dddd" format specifier, the DateTime.ToString method includes the value of the appropriate DayNames member in place of "dddd" in the result string.

如果 Calendar 屬性的值變更,這個屬性會受到影響。This property is affected if the value of the Calendar property changes.

適用於

另請參閱