using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MR.View { class Program { enum enXingQi { 星期一 = 1, 星期二 = 2, 星期三 = 3, 星期四 = 4, 星期五 = 5, 星期六 = 6, 星期日 = 0, } static void Main(string[] args) { int iDate = (int)DateTime.Now.DayOfWeek;//读取当前是周几 switch(iDate) { case (int)enXingQi.星期一: Console.WriteLine("今天是星期一"); break; case (int)enXingQi.星期二: Console.WriteLine("今天是星期二"); break; case (int)enXingQi.星期三: Console.WriteLine("今天是星期三"); break; case (int)enXingQi.星期四: Console.WriteLine("今天是星期四"); break; case (int)enXingQi.星期五: Console.WriteLine("今天是星期五"); break; case (int)enXingQi.星期六: Console.WriteLine("今天是星期六"); break; case (int)enXingQi.星期日: Console.WriteLine("今天是星期日"); break; } Console.ReadKey(); } } }
标签:case,Console,int,enXingQi,break,枚举,WriteLine From: https://www.cnblogs.com/csflyw/p/18341537