DayOfWeek 列挙体
曜日を指定します。
<Serializable>
Public Enum DayOfWeek
[C#]
[Serializable]
public enum DayOfWeek
[C++]
[Serializable]
__value public enum DayOfWeek
[JScript]
public
Serializable
enum DayOfWeek
解説
DayOfWeek 列挙型は、1 週間が 7 日ある予定表の曜日を表します。この列挙型の範囲は、日曜日を示す 0 から土曜日を示す 6 までです。
この列挙型は、曜日を厳密に型指定する必要がある場合に役立ちます。たとえば、この列挙型は DateTime.DayOfWeek プロパティのプロパティ値の型です。
メンバ
メンバ名 | 説明 |
---|---|
Friday
.NET Compact Framework でもサポート。 |
金曜日を示します。 |
Monday
.NET Compact Framework でもサポート。 |
月曜日を示します。 |
Saturday
.NET Compact Framework でもサポート。 |
土曜日を示します。 |
Sunday
.NET Compact Framework でもサポート。 |
日曜日を示します。 |
Thursday
.NET Compact Framework でもサポート。 |
木曜日を示します。 |
Tuesday
.NET Compact Framework でもサポート。 |
火曜日を示します。 |
Wednesday
.NET Compact Framework でもサポート。 |
水曜日を示します。 |
使用例
[Visual Basic, C#, C++] DateTime.DayOfWeek プロパティおよび DayOfWeek 列挙体の例を次に示します。
' This example demonstrates the DateTime.DayOfWeek property
Imports System
Class Sample
Public Shared Sub Main()
' Assume the current culture is en-US.
' Create a DateTime for the first of May, 2003.
Dim dt As New DateTime(2003, 5, 1)
Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}", _
dt, dt.DayOfWeek = DayOfWeek.Thursday)
Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek)
End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'Is Thursday the day of the week for 5/1/2003?: True
'The day of the week for 5/1/2003 is Thursday.
'
[C#]
// This example demonstrates the DateTime.DayOfWeek property
using System;
class Sample
{
public static void Main()
{
// Assume the current culture is en-US.
// Create a DateTime for the first of May, 2003.
DateTime dt = new DateTime(2003, 5, 1);
Console.WriteLine("Is Thursday the day of the week for {0:d}?: {1}",
dt, dt.DayOfWeek == DayOfWeek.Thursday);
Console.WriteLine("The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek);
}
}
/*
This example produces the following results:
Is Thursday the day of the week for 5/1/2003?: True
The day of the week for 5/1/2003 is Thursday.
*/
[C++]
// This example demonstrates the DateTime.DayOfWeek property
#using <mscorlib.dll>
using namespace System;
int main()
{
// Assume the current culture is en-US.
// Create a DateTime for the first of May, 2003.
DateTime dt = DateTime(2003, 5, 1);
Console::WriteLine("Is Thursday the day of the week for {0:d}?: {1}",
__box(dt), __box(dt.DayOfWeek == DayOfWeek::Thursday));
Console::WriteLine("The day of the week for {0:d} is {1}.",
__box(dt), __box(dt.DayOfWeek));
}
/*
This example produces the following results:
Is Thursday the day of the week for 5/1/2003?: True
The day of the week for 5/1/2003 is Thursday.
*/
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET
アセンブリ: Mscorlib (Mscorlib.dll 内)