DayOfWeek Sabit listesi

Tanım

Haftanın gününü belirtir.Specifies the day of the week.

public enum class DayOfWeek
public enum DayOfWeek
[System.Serializable]
public enum DayOfWeek
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum DayOfWeek
type DayOfWeek = 
Public Enum DayOfWeek
Devralma
DayOfWeek
Öznitelikler

Alanlar

Friday 5

Cuma 'yi gösterir.Indicates Friday.

Monday 1

Pazartesi 'yi gösterir.Indicates Monday.

Saturday 6

Cumartesi gösterir.Indicates Saturday.

Sunday 0

Pazar gününü gösterir.Indicates Sunday.

Thursday 4

Perşembe 'yi gösterir.Indicates Thursday.

Tuesday 2

Salı olduğunu gösterir.Indicates Tuesday.

Wednesday 3

Çarşamba 'yi gösterir.Indicates Wednesday.

Örnekler

Aşağıdaki örnekte DateTime.DayOfWeek özelliği ve DayOfWeek numaralandırması gösterilmektedir.The following example demonstrates the DateTime.DayOfWeek property and the DayOfWeek enumeration.

// This example demonstrates the DateTime.DayOfWeek property
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}", 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
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
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
End Class
'
'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.
'

Açıklamalar

DayOfWeek numaralandırması hafta başına yedi güne sahip olan takvimlerdeki haftanın gününü temsil eder.The DayOfWeek enumeration represents the day of the week in calendars that have seven days per week. Bu Numaralandırmadaki sabitlerin değeri Pazar ile Cumartesi arasında değişir.The value of the constants in this enumeration ranges from Sunday to Saturday. Bir tamsayıya ayarlanırsa, değeri sıfır (Pazar) ile altıya (Cumartesi gösterir) arasında değişir.If cast to an integer, its value ranges from zero (which indicates Sunday) to six (which indicates Saturday).

Bu numaralandırma, haftanın gününü kesin olarak belirlenmiş bir belirtiye sahip olmak istediğinizde yararlıdır.This enumeration is useful when it is desirable to have a strongly typed specification of the day of the week. Örneğin, bu numaralandırma DateTime.DayOfWeek ve DateTimeOffset.DayOfWeek özellikleri için özellik değerinin türüdür.For example, this enumeration is the type of the property value for the DateTime.DayOfWeek and DateTimeOffset.DayOfWeek properties.

DayOfWeek Numaralandırmadaki Üyeler yerelleştirilmez.The members of the DayOfWeek enumeration are not localized. Haftanın gününün yerelleştirilmiş adını döndürmek için, DateTime.ToString(String) ya da DateTime.ToString(String, IFormatProvider) yöntemini "ddd" veya "gggg" biçim dizeleriyle çağırın.To return the localized name of the day of the week, call the DateTime.ToString(String) or the DateTime.ToString(String, IFormatProvider) method with either the "ddd" or "dddd" format strings. Eski biçim dizesi kısaltılmış iş günü adını üretir; İkinci gün tam hafta içi adı üretir.The former format string produces the abbreviated weekday name; the latter produces the full weekday name.

Şunlara uygulanır