Erweitern Minimieren
2 von 2 fanden dies hilfreich - Dieses Thema bewerten.

DayOfWeek-Enumeration

Gibt den Wochentag an.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public enum DayOfWeek
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public enum DayOfWeek
SerializableAttribute 
ComVisibleAttribute(true) 
public enum DayOfWeek
 MembernameBeschreibung
Unterstützt von .NET Compact FrameworkFridayGibt Freitag an. 
Unterstützt von .NET Compact FrameworkMondayGibt Montag an. 
Unterstützt von .NET Compact FrameworkSaturdayGibt Sonnabend an. 
Unterstützt von .NET Compact FrameworkSundayGibt Sonntag an. 
Unterstützt von .NET Compact FrameworkThursdayGibt Donnerstag an. 
Unterstützt von .NET Compact FrameworkTuesdayGibt Dienstag an. 
Unterstützt von .NET Compact FrameworkWednesdayGibt Mittwoch an. 

Die DayOfWeek-Enumeration stellt bei Kalendern mit 7 Wochentagen die Wochentage dar. Die Enumeration zählt von 0 für Sonntag bis 6 für Samstag.

Diese Enumeration bietet sich an, wenn eine Angabe des Wochentags mit strikter Typbindung gewünscht wird. Diese Enumeration ist z. B. der Typ des Eigenschaftenwerts für die DateTime.DayOfWeek-Eigenschaft.

Im folgenden Beispiel wird die DateTime.DayOfWeek-Eigenschaft und die DayOfWeek-Enumeration veranschaulicht.

// 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.
*/

// This example demonstrates the DateTime.DayOfWeek property
import System.*;

class Sample
{
    public static void main(String[] args)
    {
        // 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, (System.Boolean)(dt.get_DayOfWeek() == DayOfWeek.Thursday));
        Console.WriteLine("The day of the week for {0:d} is {1}.", dt, 
            dt.get_DayOfWeek());
    } //main
} //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.
*/

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0
Fanden Sie dies hilfreich?
(1500 verbleibende Zeichen)
© 2013 Microsoft. Alle Rechte vorbehalten.