UsingEnum

使用軟體: Visual c# 2008 Express
----------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class UsingEnum
{
enum WeekDay
{
sun = 1,
mon = 2,
tue = 3,
wed = 4,
thi = 5,
fri = 6,
sat = 7
}
static void Main()
{
Console.WriteLine("星期日為一周的第{0}天!!", (int)WeekDay.sun);
Console.WriteLine("星期一為一周的第{0}天!!", (int)WeekDay.mon);
Console.WriteLine("星期二為一周的第{0}天!!", (int)WeekDay.tue);
Console.WriteLine("星期三為一周的第{0}天!!", (int)WeekDay.wed);
Console.WriteLine("星期四為一周的第{0}天!!", (int)WeekDay.thi);
Console.WriteLine("星期五為一周的第{0}天!!", (int)WeekDay.fri);
Console.WriteLine("星期六為一周的第{0}天!!", (int)WeekDay.sat);

Console.ReadLine();
}
}
}

0 意見: