C#列挙の定義とその簡単な運用
using System;
using System.Collections.Generic;
using System.Text;
//
namespace interfaceDemo
{
// , 0,
// , 1, , int
class TestEnum
{
enum WeekDay//
{
Sunday,
Monday,
Tuesday,
Wednesday,
Thurday,
Friday,
Saturday
}
static void CheckDay(WeekDay day)
{
switch (day)
{
case WeekDay.Sunday://
Console.WriteLine(" ");
break;
case WeekDay.Monday:
Console.WriteLine(" ");
break;
case WeekDay.Tuesday:
Console.WriteLine(" ");
break;
case WeekDay.Wednesday:
Console.WriteLine(" ");
break;
case WeekDay.Thurday:
Console.WriteLine(" ");
break;
case WeekDay.Friday:
Console.WriteLine(" ");
break;
case WeekDay.Saturday:
Console.WriteLine(" ");
break;
default:
Console.WriteLine(" ");
break;
}
}
static void Main(string[] args)
{
CheckDay(WeekDay.Monday);
CheckDay((WeekDay)4);//
Console.ReadLine();
}
}
}
// :
//
//